Time limit
10s
Memory limit
512 MB
Sequence A is defined for every integer i as follows.
Given integers N, P, Q, X, and Y, compute A_N.
The first line contains five integers N, P, Q, X, and Y.
Print the value of A_N on one line.
⌊x⌋ denotes the greatest integer less than or equal to x.