using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace foryuki { class Program { static void Main(string[] args) { var c = (Console.ReadLine() + '\0').ToCharArray(); string x = ""; string y = ""; bool isPlus1 = true; bool isPlus2 = true; bool isPlus3 = true; int i = 0; if (c[i] == '-') { isPlus1 = false; i++; } else if (c[i] == '+') { i++; } while (char.IsNumber(c[i])) { x += c[i]; i++; } if (c[i] == '-' && (c[i + 1] == '+' || c[i + 1] == '-')) { isPlus2 = false; i++; if (c[i] == '-') { isPlus3 = false; } i++; } else if (c[i] == '+' && (c[i + 1] == '+' || c[i + 1] == '-')) { i++; if (c[i] == '-') { isPlus3 = false; } i++; } else if (c[i] == '+') { i++; } else if (c[i] == '-') { isPlus3 = false; i++; } while (char.IsNumber(c[i])) { y += c[i]; i++; } int a = (isPlus1 ? 1 : -1) * int.Parse(x); int b = (isPlus3 ? 1 : -1) * int.Parse(y); int ans; if (isPlus2) { ans = a - b; } else { ans = a + b; } Console.WriteLine(ans); } //------------------------------------------------------------- static int[] ConvertStringArrayToIntArray(string[] array) { return Array.ConvertAll(array, str => int.Parse(str)); } static List ConvertStringArrayToIntList(string[] str) { var list = new List(); foreach (var c in str) { list.Add(int.Parse(c)); } return list; } } }