Mod Arithmetic

No attempts yetTime limit1sMemory limit256 MB

Problem

You are given three numbers AA, BB, CC. Write a program that computes the following four values in order.

  1. (A + B) % C
  2. ((A % C) + (B % C)) % C
  3. (A × B) % C
  4. ((A % C) × (B % C)) % C

Here % is the remainder operator, so x % y is the remainder of xx divided by yy.

Input

The first line contains AA, BB, CC in that order, separated by spaces. (2A,B,C100002 \le A, B, C \le 10000)

Output

Print the four values on four lines, one per line. Print (A + B) % C on the first line, ((A % C) + (B % C)) % C on the second line, (A × B) % C on the third line, and ((A % C) × (B % C)) % C on the fourth line.