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