Just in case somebody missed it: this winter is totally cold in Nvodsk! It is so cold that one gets funny thoughts. For example, let's say there are strings with the length exactly n, based on the alphabet of size m. Any its substring with length equal to k is a palindrome. How many such strings exist? Your task is to find their quantity modulo 1000000007 (109 + 7). Be careful and don't miss a string or two!

Let us remind you that a string is a palindrome if it can be read the same way in either direction, from the left to the right and from the right to the left.

Input

The first and only line contains three integers: n, m and k (1 ≤ n, m, k ≤ 2000).

Output

Print a single integer — the number of strings of the described type modulo 1000000007 (109 + 7).

Examples

Input

1 1 1


Output

1


Input

5 2 4


Output

2

Note

In the first sample only one string is valid: "a" (let's denote the only letter of our alphabet as "a").

In the second sample (if we denote the alphabet letters as "a" and "b") the following strings are valid: "aaaaa" and "bbbbb".
import java.util.*;
import java.io.*;
import java.math.*;
public class D107{
	static int mod=1000000007;
	public static void initialize(int a[],int siz[],int n){
		for(int i=1;i<=n;i++){
			a[i]=i;
			siz[i]=1;
		}
		return;
	}
	public static int root(int a[],int i){
		while(a[i]!=i){
			a[i]=a[a[i]];
			i=a[i];
		}
		return i;
	}
	public static boolean find(int a[],int x,int y){
		if(root(a,x)==root(a,y))
			return true;
		else 
			return false;
	}
	public static void union(int a[],int siz[],int x,int y){
		int rootx=root(a,x);
		int rooty=root(a,y);
		if(rootx==rooty)
			return;
		if(siz[rootx]<siz[rooty]){
			a[rootx]=a[rooty];
			siz[rooty]+=siz[rootx];
		}
		else{
			a[rooty]=a[rootx];
			siz[rootx]+=siz[rooty];
		}
		return;
	}

	public static void main(String args[]){
		FastReader sc = new FastReader();
		int n,m,k;
		n=sc.nextInt();
		m=sc.nextInt();
		k=sc.nextInt();
		if(k==1||k>n){
			long ans=fastexpo(m,n,mod);
			System.out.println(ans);
			System.exit(0);
		}
		if(k==n){
			long ans=fastexpo(m,(n+1)/2,mod);
			System.out.println(ans);
			System.exit(0);
		}
		//If you connect the corresponding indices of the string we notice that when k is even for all the susbtrings to be of size k to be palindromic they form a single component. But for odd k they form 2 components
		if(k%2==0){
			out.println(m);
		}
		else{
			out.println(fastexpo(m,2,mod));
		}
		out.flush();
	}
	static class pair{
		int l,r;
		public pair(int f,int s){
			l=f;
			r=s;
		}
	}

	static PrintWriter out;
	static class FastReader{
		BufferedReader br;
		StringTokenizer st;
		public FastReader(){
			br=new BufferedReader(new InputStreamReader(System.in));
			out=new PrintWriter(System.out);
		}
		String next(){
			while(st==null || !st.hasMoreElements()){
				try{
					st= new StringTokenizer(br.readLine());
				}
				catch (IOException e){
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}
		int nextInt(){
			return Integer.parseInt(next());
		}
		long nextLong(){
			return Long.parseLong(next());
		}
		double nextDouble(){
			return Double.parseDouble(next());
		}
		String nextLine(){
			String str = "";
			try{
				str=br.readLine();
			}
			catch(IOException e){
				e.printStackTrace();
			}
			return str;
		}
	}

	public static boolean isPrime(int n) {
		if(n<2) return false;
		for(int i=2;i<=(int)Math.sqrt(n);i++) {
			if(n%i==0) return false;
		}
		return true;
	}

	public static void print(int a[],int l,int r){
		int i;
		for(i=l;i<=r;i++)
			out.print(a[i]+" ");
		out.println();
	}

	public static long fastexpo(long x, long y, long p){
		long res=1;
		while(y > 0){
			if((y & 1)==1)
				res= ((res%p)*(x%p))%p;
			y= y >> 1;			
			x = ((x%p)*(x%p))%p;
		}
		return res;
	}

	public static boolean[] sieve (int n) {
		boolean primes[]=new boolean[n+1];
		Arrays.fill(primes,true);
		primes[0]=primes[1]=false;
		for(int i=2;i*i<=n;i++){
			if(primes[i]){
				for(int j=i*i;j<=n;j+=i)
					primes[j]=false;
			}
		}
		return primes;
	}

	public static long gcd(long a,long b){
        return (BigInteger.valueOf(a).gcd(BigInteger.valueOf(b))).longValue();
    }

    public static void merge(int a[],int l,int m,int r){
        int n1,n2,i,j,k;
        n1=m-l+1;
        n2=r-m;

        int L[]=new int[n1];
        int R[]=new int[n2];

        for(i=0;i<n1;i++)
            L[i]=a[l+i];
        for(j=0;j<n2;j++)
            R[j]=a[m+1+j];

        i=0;j=0;

        k=l;
        while(i<n1&&j<n2){
            if(L[i]<=R[j]){
                a[k]=L[i];
                i++;
            }
            else{
                a[k]=R[j];
                j++;
            }
            k++;
        }

        while(i<n1){
            a[k]=L[i];
            i++;
            k++;
        }
        while(j<n2){
            a[k]=R[j];
            j++;
            k++;
        }
    }
    public static void sort(int a[],int l,int r){
        int m;
        if(l<r){
            m=(l+r)/2;
            sort(a,l,m);
            sort(a,m+1,r);
            merge(a,l,m,r);
        }
    }
}

