import java.io.InputStream; import java.io.InputStreamReader; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.Deque; import java.util.HashMap; import java.util.InputMismatchException; import java.util.Map; import java.util.PriorityQueue; import java.util.Scanner; import java.math.BigInteger; public class Main{ static final InputStream in=System.in; static final PrintWriter out=new PrintWriter(System.out); public static void main(String[] args) throws IOException{ Scanner sc=new Scanner(in); BigInteger n=sc.nextBigInteger(); BigInteger m=sc.nextBigInteger(); out.println(n.modPow(m,BigInteger.valueOf(129402307))); out.flush(); } }