#include #include using namespace std; int main() { long long int a,b,c,d; scanf("%lld %lld %lld %lld", &a, &b, &c, &d); printf("%lld\n", (a%d)*(b%d)*(c%d)); return 0; }