CALCULAT spoj

SPOJ.com - Problem CALCULAT I have been trying solving this problem, I have first tried to calculate first k digits of factorial using stirling approximation but due to precision my code don’t give perfect ans for all factorials and I cant figure out how to find last l digits of factorial. Can someone tell me how to crack this problem.
Thnks.