/*
  AOJ 2070
  Title:First Experience
  @kankichi573
*/
#include <stdio.h>
char expr[81];

int calc(int r1,int r2,char op)
{
  if(op=='+')
    return(r1+r2);
  if(op=='-')
    return(r1-r2);
  if(op=='*')
    return(r1*r2);
  if(op==' ')
    return(r2);
}


main()
{
  int R1,R2,i;
  char R3,c,err;
  
  while(EOF!=scanf("%s",expr))
    {
      R1=R2=0,R3=' ',err=0;
      for(i=0;expr[i];i++)
	{
	  c=expr[i];
	  if(isdigit(c))
	    {
	      R2 *= 10;
	      R2 += (c-'0');
	      if(R2>=10000)
		{
		  err=1;
		  break;
		}
	    }
	  else if(c=='+'||c=='-'||c=='*'||c=='=')
	    {
	      R1=calc(R1,R2,R3);
	      if(R1>=10000 || R1 < 0)
		{
		  err=1;
		  break;
		}
	      R2=0;
	      R3=c;
	    }
	}
      if(err)
	printf("E\n");
      else
	printf("%d\n",R1);
    }
  return(0);
}