import re
import sys
s = ''
for line in sys.stdin:
s += line
if '}' in line:
break
t = re.sub(r'(\s*)\w*:(\s*)', r'\n',
re.sub(r"\s*bool\s*|\s*main\s*\(\s*\)\s|{", r'', re.sub(r'(\W)(\d+\w*)', r'\1a_\2', s)).strip().replace(
'=', ' = '))
x, y, c = 0, 0, 0
while t.find('done', x + 1) != -1:
x0 = x
x = t.find('done', x)
y = t.find('while', x0)
c = len(t)
q = t[y:x].replace(';', ';;').split()
if "=" in q:
q[q.index("=") - 2] += ':'
else:
q[q.index("pass") - 1] += ':'
q[q.index('while')] += ' '
t = t[:y - 1] + '\n' + "".join(q) + t[x + 4:]
x = x + len(t) - c + 4
x, y, c = 0, 0, 0
while t.find('fi', x + 1) != -1:
x0 = x
x = t.find('fi', x)
y = t.find('if', x0)
c = len(t)
q = t[y:x].replace(';', ';;').split()
if "=" in q:
q[q.index("=") - 2] += ':'
else:
q[q.index("pass") - 1] += ':'
q[q.index('if')] += ' '
t = t[:y - 1] + '\n' + "".join(q) + t[x + 2:]
x = x + len(t) - c + 2
exec(re.sub(r'\s*:', r":", ('def evaluate():\n\tcount=0\n\t' + re.sub(r';+', r'\n',
t.replace('done', '').replace("fi",
'').replace(
'pass', '').replace(';;', "\n\t").replace(
':',
':\n\tcount+=1\n\tif (count)>200:\n\t\treturn "infinite"\n\t')).replace(
'!', ' not ').replace('&', ' and ').replace('|', ' or ').replace('\n', '\n\t').replace('}', '').replace(
'\n\t\n',
'\n'))))
print(evaluate())