def isfloat(num):
    try:
        float(num)
        return True
    except ValueError:
        return False
file=open(input('.gar: ')+'.gar','r').readlines();import time as t
for i in range(len(file)):
    if'\n'in file[i]:
        file[i]=file[i][:-1]
stack=[]
j=0
while j < len(file):
    try:
        inp=''
        k=file[j]
        error='1'
        if k[0]=='>':
            error='0'
            stack+=[k.count('>')]
        if k[0]=='<':
            error='0'
            stack+=[-k.count('<')]
        if k=='+':
            error='0'
            stack+=[stack[-1]+stack[-2]]
            del stack[-2]
            del stack[-2]
        if k=='-':
            error='0'
            stack+=[stack[-1]-stack[-2]]
            del stack[-2]
            del stack[-2]
        if k=='*':
            error='0'
            stack+=[stack[-1]*stack[-2]]
            del stack[-2]
            del stack[-2]
        if k=='/':
            error='0'
            stack+=[stack[-1]/stack[-2]]
            del stack[-2]
            del stack[-2]
        if k=='%':
            error='0'
            stack+=[stack[-1]%stack[-2]]
            del stack[-2]
            del stack[-2]
        if k=='!':
            error='0'
            print(stack[-1])
            del stack[-1]
        if k=='!!':
            error='0'
            print(' '.join(str(z) for z in stack))
        if k==',':
            error='0'
            print(chr(stack[-1]))
            del stack[-1]
        if k=="|":
            error='0'
            stack+=[-stack[-1]]
            del stack[-2]
        if k==',,':
            error='0'
            print(''.join(chr(x) for x in stack))
        if k=='~':
            error='0'
            del stack[-1]
        if k=='~~':
            error='0'
            stack=[]
        if k==':':
            error='0'
            stack+=[stack[-1]]
        if k=='::':
            error='0'
            stack+=[stack[-1]]
            stack[-2]=stack[-3]
        if k=='&':
            error='0'
            stack[-1],stack[-2]=stack[-2],stack[-1]
        if k=='&&':
            error='0'
            stack=stack[::-1]
        if k[0] in '{[(':
            error='0'
        if k[0]=='#':
            error='0'
        if k[0]=='}':
            error='0'
            j=file.index('{'*k.count('}'))
            t.sleep(0.1)
        if k[0]==')':
            error='0'
            j=file.index('('*k.count(')'))
        if k[0]==']':
            error='0'
            if not stack[-1]==0:
                j=file.index('['*k.count(']'))
        if k=='?':
            error='0'
            while not isfloat(inp):
                inp=input('> ')
            stack+=[float(inp)]
        if k=='??':
            error='0'
            while not len(inp)==1:
                inp=input('> ')
            stack+=[ord(inp)]
        if k=='???':
            error='0'
            stack+=[ord(x) for x in [*input('> ')]]
        if k=='f':
            error='0'
            stack=(ord(x) for x in [*(''.join(open(''.join(chr(x) for x in stack),'r').readlines()))])
        if k=='v':
            error='0'
            save1=list(stack)
        if k=='vv':
            error='0'
            stack+=save1
        if k=='vvv':
            error='0'
            stack=list(save1)
        if k=='^':
            error='0'
            save2=list(stack)
        if k=='^^':
            error='0'
            stack+=save2
        if k=='^^^':
            error='0'
            stack=list(save2)
        if k=='$':
            error='0'
            save3=list(stack)
        if k=='$$':
            error='0'
            stack+=save3
        if k=='$$$':
            error='0'
            stack=list(save3)
        if k=='"':
            error='0'
            stack+=(ord(x) for x in str(stack[-1]))
        if error=='1':
            print("{ERROR}")
            break
        j+=1
        #print(stack)
    except:
        print("{ERROR}")
        break
t.sleep(10000)