Time Limit: 1000 ms Memory Limit: 65536 KiB
Lin sometimes can be very careless. One day, he wrote n letter(s), but he put each of them in the wrong envelop. How many are the way(s) can he do this identically(different arrangement of the letter-envelop combinations). Because the number can be very big, to avoid the precision problem, modulo each number by 2014.
Multiple input cases. n < 250001.
1 2 3 4
0 1 2 9
Modulo each number in each step you calculate. It’s ok.