import java.util.Scanner ;
	
class Ideone
{
	
	public static void main(String[] args)
	{
		Scanner lineScanner = new Scanner(System.in); 
		double result  = lineScanner.nextInt();
		lineScanner.nextLine(); // skip this DataRow?

		
		while (lineScanner.hasNextLine())
		{ 
			String DataRow= lineScanner.nextLine();
			if (DataRow.isEmpty())
			{ 
				System.out.print("result ="+ result );
				break;
			}
			
			String[] cells = DataRow.split(" ");
			
			int value = Integer.parseInt(cells[1]);
			
			char ch =cells[0].charAt(0); 
			switch (ch)
			{
				case '+':
					result += value  ;
					break ;
				case '-':
					result -= value  ;
					break ;
				case '*':
					result *= value  ;
					break ;
				case '%':
					result %= value  ;
					System.out.print("case % result ="+ result );
					break ;
				default :
					value = 0;
					break;
			}  
			System.out.print(" value ( result) = "+ value +"("+ result + ")" );
		}
		System.out.print("finally result ="+ result );
	}
}
