my code
I am getting wrong answers on two test cases
use long long int instead of int
as output will be large so may overflow int
i hope this helps
if yes hit a like and don’t forgot to mark doubt as resolved 
if you have more doubts regarding this feel free to ask