Solution to the problem number 120 of AceptaelReto - 120.

Any questions do not hesitate to contact.

#include <bits/stdc++.h>
using namespace std;

int main() {
    int n, k;
    while (scanf("%d%d",&n,&k)==2 && (n != 0 || k != 0))
        cout << (n*n*n + n) / 2 + (k-1) * n << '\n';

    return 0;
}

Don't miss anything.

Keep in touch with Isaac Lozano Osorio!