package com.njupt.acm;
import java.math.BigInteger;
import java.util.Scanner;
public class SGU_112 {//往SGU提交的时候,需要把类名写成Solution,详细信息,可以去看FAQ
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int a = scanner.nextInt();
int b = scanner.nextInt();
System.out.println(new BigInteger(a+"").pow(b).subtract(new BigInteger(b+"").pow(a)));
}
}