#include using namespace std; #define rep(i,a,b) for(int i=a;i> A >> B >> C >> D) { cout << ((A * B * C) % D) << endl; } }