For this Question: Taro loves colours. Today she is interested in painting bricks. N bricks are arranged in a line. She needs to paint them using K colours. She does not want two adjacent bricks to be painted in same colour. Can you help her find the number of ways she can colour the given N bricks.

As the answer can be large print it modulo 1000000007.

Property: (a*b)%c = ((a%c)*(b%c))%c.The first and the only line of input contains 2 integers N and K.

Constraints
1 <= N <= 1000
2 <= K <= 1000Output a single integer, the number of ways in which she can colour the bricks modulo 1000000007.Sample Input
2 2

Sample Output
2

Explanation: Let the colours be 1 and 2. The ways of colouring the bricks are "1 2" or "2 1".

Sample Input:
1 10

Sample Output:
10, I have written this Solution Code: import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    static final int MOD = 1000000007;

    static long modPow(long base, long exp, long mod) {
        long x = 1;
        while (exp > 0) {
            if (exp % 2 == 1)
                x = (x * base) % mod;
            base = (base * base) % mod;
            exp = exp / 2;
        }
        return x;
    }

    static long getColorPossibilities(long bricks, long colors) {
        return (colors%MOD * modPow(colors-1, bricks-1, MOD))%MOD;
    }

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String inp[] = br.readLine().split(" ");
        System.out.println(getColorPossibilities(Long.parseLong(inp[0]), Long.parseLong(inp[1])));
    }
}
, In this Programming Language: Java, Now tell me if this Code is compilable or not?