#include<bits/stdc++.h>
#define ri register int
#define ll long long
using namespace std;
inline int rd(){
	int res = 0,f = 0;
	char ch = getchar();
	for(;!isdigit(ch);ch = getchar()) if(ch == '-') f = 1;
	for(;isdigit(ch);ch = getchar()) res = (res<<3) + (res<<1) + ch - 48;
	return f ? -res : res;
}
int main(){
	int n = rd(),k = rd();
	ll ans = 0;
	for(ri i = 1;i <= n;++i)
		for(ri j = 1;j <= k;++j) ans += i*100 + j;
	printf("%lld\n",ans);
	return 0;
}

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <utility>
#include <algorithm>
#include <cmath>
#include <climits>
#include <iomanip>
#include <queue>
#include <stack>

using namespace std;

typedef long long ll;

#define rep(i, n) for (ll i = 0; i < n; i++)

int main() {
    int n;  cin >> n;
    vector<ll> a(n), s(n+1, 0);
    set<ll> st;
    rep(i, n) {
        cin >> a[i];
        s[i+1] = a[i] + s[i];
    }
    ll ans = -1e18, tmp = 0;
    st.insert(s[0]);
    rep(i, n) {
        st.insert(s[i+1]);
        ans = max(tmp + *st.rbegin(), ans);
        tmp += s[i+1];
    }

    cout << ans << endl;
    return 0;
}

//小数点精度
//cout << fixed << std::setprecision(15) << y << endl;