import java.math.BigInteger;
import java.util.Scanner;

/**
 * Performs unbounded integer exponentiation with a user-specified base and exponent. 
 * 
 * @author Drue Coles
 */
public class PowerCalculator2 {

    public static void main(String[] args) {
        
        // Prompt the user and read input.
        System.out.print("Enter two integers (base and exponent): ");
        Scanner in = new Scanner(System.in);
        
        // Read two numbers and raise the first to the power of the second.
        BigInteger base = in.nextBigInteger();    
        int exponent = in.nextInt();
        BigInteger result = base.pow(exponent);

        // Format and display result as an equation.
        String output = base + "^" + exponent + " = " + result;
        System.out.println(output);
    }
}