import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine(), " ");
int a = Integer.parseInt(st.nextToken());
int b = Integer.parseInt(st.nextToken());
int c = Integer.parseInt(st.nextToken());
System.out.println((a + b) % c);
System.out.println(((a % c) + (b % c)) % c);
System.out.println((a * b) % c);
System.out.println(((a % c) * (b % c)) % c);
}
}
A, B, C 입력을 받고 주어진 수식을 출력하는 간단한 문제