#include <algorithm>
#include <iostream>
#include <stdio.h>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <string>
#include <cmath>
using namespace std;
int main() {
//freopen("input.txt", "rt", stdin);
int a, b, c;
scanf("%d %d %d", &a, &b, &c);
printf("%d\n", (a + b) % c);
printf("%d\n", ((a % c) + (b % c)) % c);
printf("%d\n", (a * b) % c);
printf("%d\n", ((a % c) * (b % c)) % c);
return 0;
}