The Java editorial solutions for this problem are a joke


#1

Most of them use BigInteger and the one which doesn’t passes the problem because the test case suck.