lunchtime january (LCH15JEF)

http://discuss.codechef.com/questions/62658/lch15jef -editorial
this is the link to the editorial of the problem
http://www.codechef.com/problems/LCH15JEF
i want to ask will the method of multiplying 2 large numbers would work if two numbers are 2^36 and 2^36
, if yes please explain how will it work??

this is the template::
long long MOD;
long long mult(long long A, long long B)

 {if ( B == 0 ) return 0;


long long u = mult(A, B/2);

long long res;
if ( B%2 == 0 ) 
    res = u + u;
else
    res = u + u + A;
while ( res >= MOD ) res -= MOD;
return res;

}
then in which case it would work???

How it’ll work, you may refer this.

what will happen after k is more than 20, that is what will happen for this expression (987654321^(12345678912345678912))