There are N balls placed in a row. AtCoDeer the deer is painting each of these in one of the K colors of his paint cans. For aesthetic reasons, any two adjacent balls must be painted in different colors.

Find the number of the possible ways to paint the balls.

Constraints

* 1≦N≦1000
* 2≦K≦1000
* The correct answer is at most 2^{31}-1.

Input

The input is given from Standard Input in the following format:


N K


Output

Print the number of the possible ways to paint the balls.

Examples

Input

2 2


Output

2


Input

1 10


Output

10
#include <bits/stdc++.h>
using namespace std;
long long int power(long long int x, long long int n) {
  long long int result = 1;
  while (n) {
    if (n % 2 == 1) result = result * x;
    n = n / 2;
    x = x * x;
  }
  return result;
}
long long int gcd(long long int a, long long int b) {
  if (!b) return a;
  return gcd(b, a % b);
}
long long int lcm(long long int a, long long int b) {
  return (a * b) / gcd(a, b);
}
inline long long int mul(long long int x, long long int y, long long int m) {
  long long int z = 1LL * x * y;
  if (z >= m) {
    z %= m;
  }
  return z;
}
long long int powmod(long long int x, long long int y, long long int m) {
  long long int r = 1;
  while (y) {
    if (y & 1) {
      r = mul(r, x, m);
    }
    y >>= 1;
    x = mul(x, x, m);
  }
  return r;
}
void start() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
}
int main() {
  start();
  long long int a, b;
  cin >> a >> b;
  if (a == 1) {
    cout << b;
  } else {
    cout << b * (b - 1) * (a - 1);
  }
  return 0;
}
