Ravi and his Ex - B

0

0 votes
Easy
Problem

Ravi claims every beautiful girl that passes by to be his ex while none of his friends has ever seen him with his so claimed girlfriend. Ravi finally has found a girl in his hometown and really wants to propose her.

He is fond of mathematics too and is stuck with a problem on series. He has asked you to help him out with the problem so that he may take her to a restaurant.

X = 1 * 0! - 2 * 1! + 3 * 2! - 4 * 3! + 5 * 4! + ... n*(n-1)!

where n! = n * (n-1) * (n-2) * (n-3) *.... 1

The only line of the input contains the value on n and M separated by a space.

You have to print the value of |X|%M

Your Input : 631241 2343

NOTE You do not need to create a program for this problem you have to write your answers of given input in given code snippet

  • To see how to submit solution please check this link

Compile and Test can give Wrong Answer. Once you have written your answer, press Submit button to check your result.

Sample Input
99999 87
Sample Output
68
Time Limit: 5
Memory Limit: 256
Source Limit:
Contributers:
Editor Image

?