#include int main(){ unsigned long long int a, b, c, d; scanf("%llu %llu %llu %llu", &a, &b, &c, &d); unsigned long long int answer = a * b * c % d; printf("%llu\n", answer); return 0; }