Problem:
Power

For given integers m and n, compute mn (mod 1,000,000,007). Here, A (mod M) is the remainder when A is divided by M.

Input

m n

Two integers m and n are given in a line.

Output

Print mn (mod 1,000,000,007) in a line.

Constraints

1 ≤ m ≤ 100

1 ≤ n ≤ 109

Sample Input 1

2 3

Sample Output 1

8

Sample Input 2

5 8

Sample Output 2

390625

Solution in C# (judge verdict: Wrong Answer)

// Elementary Number Theory - Power
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=NTL_1_B
using System;
using System.Linq;
using System.Collections.Generic;

namespace NTL_1_B {
	class Program {
        const ulong mod = 1000000007;
		public Program() {}
		
		public static void Main() {
			new Program().Calc();
		}
		
		void Calc() {
			var n = Input.Split(' ')
                            .Select(i => ulong.Parse(i))
			                .ToArray();
			Output(power(n[0], n[1]).ToString());
		}
		
		String Input {
			get {
				return Console.ReadLine();
			}
		}
		
		void Output(String str) {
			Console.WriteLine(str);
		}
		
		ulong power(ulong n, ulong m) {
            if(m == 0) return 1;
            ulong tmp = power(n, m / 2) % mod;
            if(m % 2 == 0) return tmp * tmp % mod;
            return tmp * tmp * n % mod;
		}
	}
}