#CCBCHMUOI0000002. Bộ tính số dư an toàn (Safe Remainder Calculator)

Bộ tính số dư an toàn (Safe Remainder Calculator)

Safe Remainder Calculator

Source: Phước Hưng OJ

Version: Phuoc Hung OJ Extended

Problem Statement

Given operation code k and integers a and b, codes 1, 2 and 3 compute a+b, a-b and a*b; code 4 computes the C-language integer remainder a%b. For code 4 with b=0 print ERROR instead. For unsupported codes print INVALID. In C, integer division truncates toward zero, and a nonzero remainder has the sign of a.

Input

One line contains integers k, a and b, in that order.

Output

Print the integer result, ERROR or INVALID as specified.

Subtasks

  • Subtask 1 (20%): 1 <= k <= 3 and -10 <= a,b <= 10.
  • Subtask 2 (30%): 1 <= k <= 4, -100 <= a,b <= 100; b != 0 whenever k = 4.
  • Subtask 3 (50%): -10 <= k <= 10 and -1000 <= a,b <= 1000.

Examples

Example 1

Input

4 7 3

Output

1

Explanation

The truncated quotient is 2, so 7=2*3+1 and the remainder is 1.

Example 2

Input

4 -7 3

Output

-1

Explanation

In C, -7/3 truncates to -2, so the remainder is -1.

Example 3

Input

4 7 0

Output

ERROR

Explanation

Remainder by zero is invalid, so print ERROR.

Example 4

Input

8 7 0

Output

INVALID

Explanation

Code 8 is invalid, not a remainder operation.