One very experienced problem writer decided to prepare a problem for April Fools Day contest. The task was very simple - given an arithmetic expression, return the result of evaluating this expression. However, looks like there is a bug in the reference solution...


-----Input-----

The only line of input data contains the arithmetic expression. The expression will contain between 2 and 10 operands, separated with arithmetic signs plus and/or minus. Each operand will be an integer between 0 and 255, inclusive.


-----Output-----

Reproduce the output of the reference solution, including the bug.


-----Examples-----
Input
8-7+6-5+4-3+2-1-0

Output
4

Input
2+2

Output
-46

Input
112-37

Output
375

Difficulty: introductory

Starter code:

Solutions:
res = 0
val = 0
sub = False
for c in input()+'+':
  if c == '+' or c == '-':
     if sub: val *= -1
     res += val
     val = 0
     sub = (c == '-')
  val *= 10
  val += ord(c) - ord('0')
print(res)

s = input()

ops = []

for i in range(0,len(s)):
    ch = s[i]
    if ch == '+' or ch == '-':
        ops.append(i)
ops.append(len(s))


for i in range(0,len(ops)-1):
    ch = s[ops[i]]
    if ch == '-':
        s += '+3'
    if ch == '+':
        s += '-5'
    for j in range(ops[i], ops[i + 1] - 1):
        s += '0'

#print(s)
print(eval(s))

s = input()
val = eval(s)
for i in range(len(s)):
    if s[i] == '+':
        c = -5
        j = i+1
        while j < len(s) and s[j] != '+' and s[j] != '-':
            j += 1
            c *= 10
        val += c
    if s[i] == '-':
        c = 3
        j = i+1
        while j < len(s) and s[j] != '+' and s[j] != '-':
            j += 1
            c *= 10
        val += c
print(val)


s = input()
now = 0
n = len(s)
ans = []
while (now < n) and (s[now] != '-') and (s[now] != '+'):
    ans.append(ord(s[now])-48)
    now += 1
ans.reverse()
while now < n:
    opt = s[now]
    now += 1
    a = [ord(opt)-48]
    while (now < n) and (s[now] != '-') and (s[now] != '+'):
        a.append(ord(s[now])-48)
        now += 1
    a.reverse()
    if len(a) <= len(ans):
        for i in range(len(ans) - len(a)):
            a.append(0)
    else:
        for i in range(len(a) - len(ans)):
            ans.append(0)
    for i in range(len(ans)):
        if opt == '-':
            ans[i] -= a[i]
        else:
            ans[i] += a[i]
ret = 0
ans.reverse()
for i in range(len(ans)):
    ret = ret * 10 + ans[i]
print(ret)


a = input()
q, s = [0], 0
z = []
for i in range(len(a)):
    y = a[i]
    if (y=="+"):
        z.append(1)
        q.append(0)
        s+=1
    elif (y=="-"):
        z.append(-1)
        q.append(0)
        s+=1
    q[s] = 10*q[s] + (ord(y)-ord("0"))
otv = q[0]
for i in range(1, s+1):
    otv += z[i-1]*q[i]
print(otv)

s = input()
val = eval(s)
for i in range(len(s)):
    if s[i] == '+':
        c = -5
        j = i+1
        while j < len(s) and s[j] != '+' and s[j] != '-':
            j += 1
            c *= 10
        val += c
    if s[i] == '-':
        c = 3
        j = i+1
        while j < len(s) and s[j] != '+' and s[j] != '-':
            j += 1
            c *= 10
        val += c
print(val)

s = [ord(c) - 48 for c in input()]
r, t, f = 0, 0, 1
for x in s:
    if x < 0:
        r += f * t
        f = -4 - x
        t = 0
    t = t * 10 + x
print(r + f * t)


from re import sub as b
print(eval(b(r'`', '-', b(r'(?P<a>-\d*)', lambda x: b('-', '+3', x.group('a') * 3, 1), b(r'(?P<a>\+\d*)', lambda x: b('\+', '`5', x.group('a') * 3, 1), input())))))


s = input()
val = eval(s)
for i in range(len(s)):
    if s[i] == '+':
        c = -5
        j = i+1
        while j < len(s) and s[j] != '+' and s[j] != '-':
            j += 1
            c *= 10
        val += c
    if s[i] == '-':
        c = 3
        j = i+1
        while j < len(s) and s[j] != '+' and s[j] != '-':
            j += 1
            c *= 10
        val += c
print(val)

res = 0
cur = 0
sign = +1
for c in input() + "+":
    if c in "+-":
        res += sign * cur
        cur = 0
    if c == '+':
        sign = +1
    if c == '-':
        sign = -1
    cur = cur * 10 + ord(c) - ord('0')
print(res)


s = input()
val = eval(s)
for i in range(len(s)):
    if s[i] == '+':
        c = -5
        j = i+1
        while j < len(s) and s[j] != '+' and s[j] != '-':
            j += 1
            c *= 10
        val += c
    if s[i] == '-':
        c = 3
        j = i + 1
        while j < len(s) and s[j] != '+' and s[j] != '-':
            j += 1
            c *= 10
        val += c
print(val)

s = input()
val = eval(s)
for i in range(len(s)):
    if s[i] ==  '+':
        j = i + 1
        c = -5
        while j < len(s) and s[j] != '+' and s[j] != '-':
            c *= 10
            j += 1
        val += c
    elif s[i] == '-':
        j = i + 1
        c = 3
        while j < len(s) and s[j] != '+' and s[j] != '-':
            c *= 10
            j += 1
        val += c
print(val)

in_str = input().replace('-', ' - ').replace('+', ' + ').split()
res = int(in_str[0])
for i in range(1, len(in_str) - 1):
    if in_str[i] == '+':
        res += int(in_str[i + 1]) - 5 * (10 ** len(in_str[i + 1]))
    elif in_str[i] == '-':
        res -= int(in_str[i + 1]) - 3 * (10 ** len(in_str[i + 1]))
    else:
        pass
print(res)


s = input().strip() + '+'
ans = 0

curr = 0
sign = 1
for c in s:
    if c in '-+':
        ans += sign*curr
        curr = 0
    if c == '-':
        sign = -1
    elif c == '+':
        sign = 1
    curr = curr*10 + (ord(c) - ord('0'))
print(ans)


ans=0
op=1
now=0
s=input()
l=len(s)
for i in range(l):
    if s[i]=='+':
        ans=ans+op*now
        now=0
        op=1
    elif s[i]=='-':
        ans=ans+op*now
        now=0
        op=-1
    now=now*10+ord(s[i])-48
ans=ans+op*now
print(ans)

s = input()
val = eval(s)
for i in range(len(s)):
    if s[i] == '+':
        c = -5
        j = i+1
        while j < len(s) and s[j] != '+' and s[j] != '-':
            j += 1
            c *= 10
        val += c
    if s[i] == '-':
        c = 3
        j = i + 1
        while j < len(s) and s[j] != '+' and s[j] != '-':
            j += 1
            c *= 10
        val += c
print(val)

s = map(lambda c: ord(c) - 48, input())
r, t, f = 0, 0, 1
for x in s:
    if x < 0:
        r += f * t
        f = -4 - x
        t = 0
    t = t * 10 + x
print(r + f * t)

s = input().strip() + '+'
ans = 0

curr = 0
sign = 1
for c in s:
    if c in '-+':
        ans += sign*curr
        curr = 0
    if c == '-':
        sign = -1
    elif c == '+':
        sign = 1
    curr = curr*10 + (ord(c) - ord('0'))
print(ans)

s = input().strip() + '+'
ans = 0

curr = 0
sign = 1
for c in s:
    if c in '-+':
        ans += sign*curr
        curr = 0
    if c == '-':
        sign = -1
    elif c == '+':
        sign = 1
    curr = curr*10 + (ord(c) - ord('0'))
print(ans)

s = map(lambda c: ord(c) - 48, input())
r, t, f = 0, 0, 1
for x in s:
    if x < 0:
        r += f * t
        f = -4 - x
        t = 0
    t = t * 10 + x
print(r + f * t)

import re
s=input()
print(eval(s)+eval(re.sub("\d","0",s).replace("-","*3").replace("+","-5").replace("*","+")))

import re
s=input()
print(eval(s)+eval(re.sub("-|\+|\d",lambda m:["0",["+3","-5"][m[0]=="+"]][m[0]in"+-"],s)))

s = input().strip() + '+'
ans = 0

curr = 0
sign = 1
for c in s:
    if c in '-+':
        ans += sign*curr
        curr = 0
    if c == '-':
        sign = -1
    elif c == '+':
        sign = 1
    curr = curr*10 + (ord(c) - ord('0'))
print(ans)

a = input()
q, s = [0], 0
z = []
for i in range(len(a)):
    y = a[i]
    if (y=="+"):
        z.append(1)
        q.append(0)
        s+=1
    elif (y=="-"):
        z.append(-1)
        q.append(0)
        s+=1
    q[s] = 10*q[s] + (ord(y)-ord("0"))
otv = q[0]
for i in range(1, s+1):
    otv += z[i-1]*q[i]
print(otv)