Execution time limit is 1 second Runtime memory usage limit is 128 megabytes Find the value of the function
f(x,y)=⎩⎨⎧0,x≤0 or y≤0f(x−1,y−2)+f(x−2,y−1)+F(x),x≤yf(x−2,y−2)+F(y),x>y where F(n) is the n-th Fibonacci number, defined as follows:
F(0)=2,
F(1)=3,
F(n)=F(n−1)+F(n−2)
Input
Three integers x,y,m (0≤x,y≤500,m≤109).
Output
Print the value of the function f(x,y) mod m.
Examples