1749:算式求值-2

文件提交:无需freopen 内存限制:128 MB 时间限制:1.000 S
评测方式:普通裁判 命题人:
提交:3 解决:2

题目描述

表达式的定义如下:

  • 正整数是表达式;
  • 如果 lns="http://www.w3.org/1998/Math/MathML"> 是表达式,则 lns="http://www.w3.org/1998/Math/MathML">() 也是表达式
  • 如果 lns="http://www.w3.org/1998/Math/MathML">1 与 lns="http://www.w3.org/1998/Math/MathML">2 是表达式,则 lns="http://www.w3.org/1998/Math/MathML">1+2 与 lns="http://www.w3.org/1998/Math/MathML">12 也都是表达式

给定一个表达式,请计算表达式的值。

输入

一个字符序列,表示给定的算式。


数据保证

  • 输入的字符序列长度不超过 lns="http://www.w3.org/1998/Math/MathML">100,000
  • 其中出现的每个整数均为正整数且不超过 lns="http://www.w3.org/1998/Math/MathML">10000

输出

单个整数:表示表达式的值。

样例输入-1 复制

12-(2+5)

样例输出-1 复制

5