#include <cstring> #include <iostream> using namespace std; const int maxn=200; struct bigint{ int digit[maxn]; int length; bigint(); bigint(int x){ length=0; memset(digit,0,sizeof(digit)); if(x==0) digit[length++]=x; else { while(x>0){ digit[length++]=x%10; x/=10; } } } bigint(int x,int n); bigint operator+(const bigint& b); bigint operator=(const bigint& b); }; bigint::bigint() { memset(digit,0,sizeof(digit)); length=0; } bigint bigint::operator+(const bigint& b){ bigint answer; int carry=0; for(int i=0;i<length || i<b.length;i++){ int c=digit[i]+b.digit[i]+carry; answer.digit[answer.length++]=c%10; carry=c/10; } if (carry!=0){ answer.digit[answer.length++]=carry; } return answer; } bigint::bigint(int x,int n){ memset(digit,0,sizeof(digit)); length=0; while(n>0){ digit[length++]=x; n--;} } bigint bigint::operator=(const bigint& b){ memset(digit,0,sizeof(digit)); length=b.length; for(int i=0;i<b.length;i++) digit[i]=b.digit[i]; return *this; } int main() { int a, n; while (cin >> a >> n) { bigint r; while(n>0) { bigint c(a,n); r=r+c; n--; } for(int i=r.length-1;i>=0;i--) cout<<r.digit[i]; cout<<endl; } }