FOURSQ -doubt in multiplication

challenge
foursq
long
multiplication

#1

I have doubt in fourth way of multiplication as given in the editorial .if a and b are long long types and suppose a=10^11 ,b=10^11 and p=10^12 then how can we directly multiply a*b as given in statement return a * b - k * p; It should over flow there.Can any one clear my doubt??


#2

@manjunath1996 Similar question has been answered in the comments section of the FOURSQ-editorial link.


#3

got it!! Thanks.