BigInteger is used here if N = 10 ^ 9 then multiply will result into value greater than 10 ^ 18
BigInteger str = new BigInteger ( st ) ; String n1 = String . valueOf ( ( N - 1 ) ) ; String n2 = String . valueOf ( ( N - 2 ) ) ; BigInteger a = new BigInteger ( n1 ) ; BigInteger b = new BigInteger ( n2 ) ;