#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>
#include<numeric>
#include<cassert>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define rep(i,s,n) for(int i=(s); i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()
#define IN(x,s,g) ((x) >= (s) && (x) < (g))
#define ISIN(x,y,w,h) (IN((x),0,(w)) && IN((y),0,(h)))
#define print(x) printf("%d\n",x)

using namespace std;

typedef unsigned int uint;
typedef long long ll;

const int _dx[] = {0,1,0,-1};
const int _dy[] = {-1,0,1,0};

int getInt(){
  int ret = 0,c;
  c = getchar();
  while(!isdigit(c)) c = getchar();
  while(isdigit(c)){
    ret *= 10;
    ret += c - '0';
    c = getchar();
  }
  return ret;
}

int operate(char op, int a, int b){
  switch(op){
  case '+': return a+b;
  case '-': return a-b;
  case '*': return a*b;
  case ' ': return b;
  }
}

int main(){
  string str;
  while(getline(cin,str) && str.size()){
    int R1 = 0;
    int R2 = 0;
    char R3 = ' ';

    for(int i=0;; i++){
      char c = str[i];

      if(isdigit(c)){
        R2 = R2 * 10 + c - '0';
      }else{
        R1 = operate(R3,R1,R2);
        R2 = 0;
        R3 = c;
      }
      //printf("R1: %d  R2: %d  R3: %c  c: %c\n",R1,R2,R3,c);
      if(c == '=' || R1 < 0 || R1 > 9999 || R2 < 0 || R2 > 9999)
        break;
    }
    if(R1 < 0 || R1 > 9999 || R2 < 0 || R2 > 9999) puts("E");
    else printf("%d\n",R1);

  }
  return 0;
}