#include <iostream> using namespace std; int main(){ int a,n; cin>>a; while(cin>>n,n<=0){} cout<<n*(a+a+n-1)/2; return 0; }