#include <iostream>
using namespace std;
const int MAX = 200; //试出来的,一开始取100不通过
struct bigInterger {
    int data[MAX];
    int length;
    bigInterger(int a, int n);
    bigInterger operator+(bigInterger b);
};
bigInterger::bigInterger(int a, int n) {
    for (int i = 0; i < n; i++) {
        data[i] = a;
    }
    for (int i = n; i < MAX; i++) {
        data[i] = 0;
    }
    length = n;
}
bigInterger bigInterger::operator+(bigInterger b) { //默认长的加短的
    bigInterger ans(0, length);
    int carry = 0;
    for (int i = 0; i < length; i++) {
        int temp = data[i] + b.data[i] + carry;
        ans.data[i] = temp % 10;
        carry = temp / 10;
    }
    if (carry != 0) {
        ans.data[length] = 1;
        ans.length++;
    }
    return ans;
}
int main() {
    int a, n;
    while (cin >> a >> n) { // 注意 while 处理多个 case
        // cout << a + b << endl;
        bigInterger ans(a, n);
        for (int i = n - 1; i >= 1; i--) {
            ans = ans + bigInterger(a, i);
        }
        for (int i = ans.length - 1; i >= 0; i--) {
            cout << ans.data[i];
        }
        cout << endl;
    }
}
// 64 位输出请用 printf("%lld")