Problem with handling big integers

I am getting a WA but cant understand why. I took reference from other submissions but cant find the difference.

Here is my submission: Solution: 68070658 | CodeChef

Input:

1
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

Expected Output:

1

Your Output:

0

Reason:

   ll ans = fact(n);
   for(auto itr = mp.begin(); itr != mp.end(); itr++) {
       ans = ans/fact(itr->second);
   }

You try to do generate a big number, then remove factors you don’t want afterwards:
a * b * c / b

But you are doing this:
((a * b * c) % (1e9+7)) / (b % (1e9+7))

This will not work. You need to find out which factors to multiply with each other. This is what the problem wants you to do:
(a * c) % (1e9+7)
That is the same as this:
a%(1e9+7) * c%((1e9+7))