let input = require('fs').readFileSync('/dev/stdin').toString().trim();
const sol = (input) => {
const [A, B, C] = input.split(" ").map(Number);
const answer = [];
answer.push((A + B) % C);
answer.push(((A % C) + (B % C)) % C);
answer.push((A * B) % C);
answer.push(((A % C) * (B % C)) % C);
return answer;
};
const ans = sol(input);
for (let i = 0; i < ans.length; i++) {
console.log(ans[i]);
}