龟速乘
#define int long long
inline int mul_slow(int x,int y,int mod){
int res=0;
while(y){
if(y&1) res=(res+x)%mod;
x=(x+x)%mod;
y>>=1;
}
return res%mod;
}
快速乘
#define ull unsigned long long
inline ull mul_quick(ull a,ull b,ull mod){
ull d=(ull)((long double)(a/mod*b))*mod,x=a*b%mod;
ull res=x-(d%mod);
return res+(res<0?mod:0);
}
快速幂
#define int long long
inline int power(int x,int y,int mod){
int res=1;
while(y){
if(y&1) res=mul_slow(res,x,mod);
x=mul_slow(x,x,mod);
y>>=1;
}
return res%mod;
}
压位高精快速幂
#include<bits/stdc++.h>
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-fstrict-overflow")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-skip-blocks")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-fhoist-adjacent-loads")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("-funsafe-loop-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")
using namespace std;
#define int long long
const int N=1e8,Q=8;
static int st[35], top;
int n,p;
struct node{
int a[66699]={0},l=1;
void init(int y){a[0]=y;l=1;}
inline void Put (int num, bool x) {
top = 0;
while (num) st[++top] = num % 10, num /= 10;
if(x) for (int i = 1; i <= 8 - top; ++ i) putchar ('0');
while (top) putchar (st[top] + '0'), --top;
return;
}
void print(){
Put(a[l-1], 0);
for(int i=l-2;i>=0;--i)
Put(a[i], 1);
return;
}
node operator * (node x) const{
node t=*this,id;
id.l=t.l+x.l-1;
for(int i=0;i<t.l;++i){
for(int j=0;j<x.l;++j){
id.a[i+j]+=t.a[i]*x.a[j];
if(id.a[i+j]>=N){
id.a[i+j+1]+=id.a[i+j]/N;
id.a[i+j]%=N;
}
}
}
while(id.a[id.l]){
id.a[id.l+1]+=id.a[id.l]/N;
id.a[id.l++]%=N;
}
return id;
}
}q1,p1;
inline void power(int r,int t){
q1.init(1);p1.init(r);
while(t){
if(t&1) q1=q1*p1;
p1=p1*p1;
t>>=1;
}
return ;
}
static inline void write(__int128 x) {
if(x<0) putchar('-'),x=-x;
if(x>9) write(x/10);
putchar(x%10+'0');
}
signed main(){
scanf("%lld%lld",&n,&p);
power(n,p);
q1.print();
return 0;
}