Consider an infinite sequence A defined as follows:
Ai=1,i≤0,
Ai=A⌊i/p⌋−x+A⌊i/q⌋−y,i≥1
You will be given n,p,q,x and y. Find the n-th element of A (index is 0-based).
Five integers n,p,q,x,y (0≤n≤1013,2≤p,q≤109,0≤x,y≤109).
Print the value of An.