//
// Written by Fyodor Menshikov 06.03.2010
//

import java.io.*;
import java.util.*;

class Set {

   final static Set EMPTY = new Set(0);

   int length;

   int pow;

   TreeSet<Integer> set = new TreeSet<Integer>();

   void wa() {
      System.out.println("wa");
      System.exit(1);
   }

   Set(int length) {
      this.length = length;
      if (length > 6) {
         wa();
      }
      pow = 1;
      for (int i = 0; i < length; i++) {
         pow *= 10;
      }
   }

   Set append(Set second) {
      if (this.length() == 0) {
         return second;
      }
      if (second.length() == 0) {
         return this;
      }
      Set result = new Set(this.length() + second.length());
      for (int i : this.set) {
         for (int j : second.set) {
            result.add(i * second.pow() + j);
         }
      }
      return result;
   }

   void add(int value) {
      set.add(value);
   }

   Set add(Set second) {
      if (this.length() != second.length()) {
         wa();
      }
      Set result = new Set(this.length());
      for (int i : this.set) {
         result.add(i);
      }
      for (int j : second.set) {
         result.add(j);
      }
      return result;
   }

   boolean contains(int value) {
      return set.contains(value);
   }

   int length() {
      return length;
   }

   int pow() {
      return pow;
   }

   public String toString() {
      String s = "";
      for (int i : set) {
         s += " " + i;
      }
      return s;
   }
}

class Text {

   String line;
   int pos;
   int c;
   final char EOT = 0;

   Text(String line) {
      this.line = line;
      pos = 0;
      nextChar();
   }

   void nextChar() {
      if (pos == line.length()) {
         c = EOT;
      } else {
         c = line.charAt(pos);
         pos++;
      }
   }
}

public class Check {

   Scanner in;
   Scanner out;

   void ac() {
      System.out.println("ac");
      System.exit(0);
   }

   void wa() {
      System.out.println("wa");
      System.exit(1);
   }

   void pe() {
      System.out.println("pe");
      System.exit(2);
   }

   void ie(String message) {
      System.out.println("Internal error: " + message);
      while (true);
   }

   void ie() {
      ie("");
   }

   boolean isLucky(int value, int len) {
      if (len % 2 != 0) {
         ie();
      }
      if (value < 0) {
         ie();
      }
      int sum = 0;
      for (int i = 0; i < len / 2; i++) {
         sum += value % 10;
         value /= 10;
      }
      for (int i = 0; i < len / 2; i++) {
         sum -= value % 10;
         value /= 10;
      }
      if (value != 0) {
         ie();
      }
      return sum == 0;
   }

   Set sequence(Text text) {
      Set set = Set.EMPTY;
      while (true) {
         Set second;
         if (text.c == '(') {
            text.nextChar();
            second = alternative(text);
            if (text.c != ')') {
               pe();
            }
            text.nextChar();
         } else if ('0' <= text.c && text.c <= '9') {
            second = new Set(1);
            second.add(text.c - '0');
            text.nextChar();
         } else {
            break;
         }
         set = set.append(second);
      }
      return set;
   }

   Set alternative(Text text) {
      Set set = sequence(text);
      while (text.c == '|') {
         text.nextChar();
         Set second = sequence(text);
         set = set.add(second);
      }
      return set;
   }

   Set parse(Text text) {
      Set set = alternative(text);
      if (text.c != text.EOT) {
         pe();
      }
      return set;
   }

   void solve() {
      int needLen = in.nextInt();
      if (!out.hasNextLine()) {
         pe();
      }
      String line = out.nextLine();
      if (out.hasNextLine() || line == null) {
         pe();
      }
      if (line.length() < 1 || line.length() > 10000) {
         pe();
      }
      for (char c : line.toCharArray()) {
         if ('0' <= c && c <= '9' || c == '(' || c == ')' || c == '|') {
            // nothing
         } else {
            pe();
         }
      }
      Set answer = parse(new Text(line));
      if (answer.length() != needLen) {
         wa();
      }
      
      int count = 1;
      for (int i = 0; i < needLen; i++) {
         count *= 10;
      }
      for (int i = 0; i < count; i++) {
         if (isLucky(i, needLen) != answer.contains(i)) {
            wa();
         }
      }
      ac();
   }

   void run(String args[]) {
      try {
         in = new Scanner(new File(args[0]));
         out = new Scanner(new File(args[1]));
      } catch (Exception e) {
         ie(e.getMessage());
      }
      try {
         solve();
      } catch (Throwable t) {
         ie(t.getMessage());
      }
   }

   public static void main(String args[]) {
      new Check().run(args);
   }
}
