// i was trying to find (n^n)%1000000007 where n is the nth fibonacci term of the series. example : n=3 ans 4 (2^2)
public class Sol_Big {
public static void main(String args[])
{
int n =10000000;
BigInteger a = BigInteger.ZERO;
BigInteger b = BigInteger.ONE;
BigInteger c = BigInteger.valueOf(1);
BigInteger MOD = BigInteger.valueOf(1000000007);
for (int j=2 ; j<=n ; j++)
{
c = a.add(b);
c=c.mod( MOD);
a = b.mod(MOD);
b = c.mod(MOD);
}
System.out.println(c);
BigInteger result = BigInteger.valueOf(1);
result = c.modPow(c, MOD);
int intval = result.intValue();
System.out.println( intval);
}
}
// my code is working for 10^7 input but for 10^8 and onward it is exceeding time limit....