import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); String s = sc.nextLine(); StringBuilder sb = new StringBuilder(s); for(int i = 0; i < sb.length(); ++i){ if(sb.charAt(i) == '-'){//在所有‘-’号前添个加号 sb.insert(i, '+');//减法统一为负数加法 ++i; } } String[] v = String.valueOf(sb).split("[+]");//按加号断开,累加就行了 int sum = 0; for(int i = 0; i < v.length; ++i) { if(!v[i].equals(""))sum += Integer.valueOf(v[i]); } System.out.println(sum); } }