#include typedef struct { unsigned long long int a; unsigned long long int b; unsigned long long int c; unsigned long long int d; } numsInfo; int main(void) { numsInfo data; scanf("%llu%llu%llu%llu", &data.a, &data.b, &data.c, &data.d); printf("%llu\n", ((data.a * data.b) * data.c) % data.d); return 0; }