const fs = require("fs");
const n = fs.readFileSync("/dev/stdin").toString().split(" ");
const a = parseInt(n[0]);
const b = parseInt(n[1]);
const c = parseInt(n[2]);
console.log((a+b)%c,((a%c)+(b%c))%c,(a*b)%c,((a%c)*(b%c))%c);