{
Written by Fyodor Menshikov 16.02.2005
}
   procedure ac;
   begin
      writeln('ok');
      halt;
   end;

   procedure wa;
   begin
      writeln('wa');
      halt(1);
   end;

   procedure pe;
   begin
      writeln('pe');
      halt(2);
   end;

var
   c:char;

   procedure nextChar;
   begin
      if eoln then
         c:=#13
      else
         read(c);
   end;

   procedure number(var n:integer);
   begin
      if c in ['1'..'9'] then begin
         n:=ord(c)-ord('0');
         nextChar;
         while c in ['0'..'9'] do begin
            n:=n*10+ord(c)-ord('0');
            nextChar;
            if n>1000 then
               n:=1000;
         end;
      end
      else
         pe;
   end;
var
   s:string;
   impossible:boolean;
   jlen,ulen,jsum,usum:integer;
   jp,up:array[0..121]of integer;
   i,j:integer;
begin
   assign(input,ParamStr(3));
   reset(input);
   readln(s);
   if s='Impossible' then
      impossible:=true
   else begin
      impossible:=false;
      reset(input);
      nextChar;
      jlen:=0;
      jsum:=0;
      while true do begin
         inc(jlen);
         number(jp[jlen]);
         jsum:=jsum+jp[jlen];
         if c='+' then
            nextChar
         else
            break;
      end;
   end;
   assign(input,ParamStr(2));
   reset(input);
   readln(s);
   if s='Impossible' then begin
      if impossible then
         ac
      else
         wa;
   end;
   reset(input);
   nextChar;
   ulen:=0;
   usum:=0;
   while true do begin
      inc(ulen);
      if ulen>jsum then
         pe;
      number(up[ulen]);
      usum:=usum+up[ulen];
      if usum>jsum then
         pe;
      if c='+' then
         nextChar
      else
         break;
   end;
   if c<>#13 then
      pe;
   readln;
   if not eof then
      pe;
   if ulen<>jlen then
      wa;
   for i:=1 to jlen do
      for j:=1 to jlen do
         if (i<j) and (jp[i]<jp[j]) then begin
            jp[0]:=jp[i];
            jp[i]:=jp[j];
            jp[j]:=jp[0];
         end;
   for i:=1 to ulen do
      for j:=1 to ulen do
         if (i<j) and (up[i]<up[j]) then begin
            up[0]:=up[i];
            up[i]:=up[j];
            up[j]:=up[0];
         end;
   for i:=1 to ulen do
      if up[i]<>jp[i] then
         wa;
   ac;
end.
