#include <bits/stdc++.h>
using namespace std;
int N, c1, c2, M;
char s[200009];
long long fx(int m) {
  int a = N / m, b = N % m;
  return 1LL * m * c1 + 1LL * c2 * (m - b) * (a - 1LL) * (a - 1LL) +
         1LL * c2 * b * (a + 0LL) * (a + 0LL);
}
void xuly() {
  cin >> N >> c1 >> c2;
  cin >> s + 1;
  for (int i = 1; s[i]; i++) M += (s[i] == '1');
  int l = 1, r = M;
  while (l < r) {
    int m = (l + r) / 2;
    if (fx(m) > fx(m + 1)) {
      l = m + 1;
    } else {
      r = m;
    }
  }
  cout << fx(l) << endl;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  xuly();
}
