#include #include int main(void){ long int a,b,c,d,goukei; scanf("%ld %ld %ld %ld",&a,&b,&c,&d); printf("%ld",(a*b*c)%d); return 0; }