package main import ( "fmt" ) func main() { var A, B, C, D int64 fmt.Scan(&A,&B,&C,&D) fmt.Println(A*B*C%D) }