{"raw_statement":[{"iden":"statement","content":"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..."},{"iden":"input","content":"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."},{"iden":"output","content":"Reproduce the output of the reference solution, including the bug."},{"iden":"examples","content":"Input\n\n8-7+6-5+4-3+2-1-0\n\nOutput\n\n4\n\nInput\n\n2+2\n\nOutput\n\n\\-46\n\nInput\n\n112-37\n\nOutput\n\n375"}],"translated_statement":[{"iden":"statement","content":"一位非常有经验的题目出题人决定为愚人节比赛准备一道题。任务非常简单——给定一个算术表达式，返回该表达式的计算结果。然而，参考程序似乎存在一个 bug...\n\n输入数据仅有一行，包含一个算术表达式。表达式将包含 2 到 10 个操作数，由加号和/或减号分隔。每个操作数均为 0 到 255（含）之间的整数。\n\n请复现参考程序的输出，包括其 bug。"},{"iden":"input","content":"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."},{"iden":"output","content":"Reproduce the output of the reference solution, including the bug."},{"iden":"examples","content":"Input\n8-7+6-5+4-3+2-1-0\nOutput\n4\n\nInput\n2+2\nOutput\n-46\n\nInput\n112-37\nOutput\n375"}],"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ E $ be an arithmetic expression of the form:  \n$$\na_1 \\circ_1 a_2 \\circ_2 a_3 \\circ_3 \\cdots \\circ_{n-1} a_n\n$$  \nwhere:  \n- $ n \\in \\mathbb{Z} $, $ 2 \\leq n \\leq 10 $, is the number of operands,  \n- $ a_i \\in \\mathbb{Z} $, $ 0 \\leq a_i \\leq 255 $, for all $ i \\in \\{1, \\dots, n\\} $,  \n- $ \\circ_j \\in \\{+, -\\} $ for all $ j \\in \\{1, \\dots, n-1\\} $.\n\n**Constraints**  \n1. The expression is given as a single string with no parentheses, no whitespace, and operands and operators concatenated directly.  \n2. All operands are non-negative integers in $[0, 255]$.  \n3. Operators are only `+` and `-`.\n\n**Objective**  \nReproduce the output of a reference solution with the following bug:  \n> The expression is evaluated **left-to-right**, ignoring standard operator precedence, **but** the first operator is **always treated as addition**, regardless of its actual symbol.\n\nThat is, define the evaluation function $ f(E) $ as:  \n$$\nf(E) = a_1 \\oplus a_2 \\oplus a_3 \\oplus \\cdots \\oplus a_n\n$$  \nwhere:  \n- $ \\oplus $ denotes left-to-right binary operation,  \n- The operation between $ a_1 $ and $ a_2 $ is **always addition**, i.e., $ a_1 + a_2 $,  \n- For $ i \\geq 3 $, the operation between the accumulated result and $ a_i $ is determined by $ \\circ_{i-1} $:  \n  $$\n  \\text{result} = \n  \\begin{cases}\n  \\text{result} + a_i & \\text{if } \\circ_{i-1} = + \\\\\n  \\text{result} - a_i & \\text{if } \\circ_{i-1} = -\n  \\end{cases}\n  $$\n\n**Note**: The bug is that the **first operator $ \\circ_1 $ is ignored** and replaced with `+`, even if it is `-`.","simple_statement":null,"has_page_source":false}