#include <bits/stdc++.h>
using namespace std;
long long f(long long g, long long c1, long long c2, long long ones,
            long long zeros) {
  long long p = (ones + zeros) / g;
  long long r = (ones + zeros) % g;
  long long sum = 0;
  for (long long i = 0; i < g; i++) {
    if (i < r)
      sum += c1 + c2 * p * p;
    else
      sum += c1 + c2 * (p - 1) * (p - 1);
  }
  return sum;
}
int main() {
  long long n, c1, c2;
  cin >> n >> c1 >> c2;
  string s;
  cin >> s;
  long long ones = 0, zeros = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == '1')
      ones++;
    else
      zeros++;
  }
  long long le = 1, ri = ones;
  long long ans = c1 + c2 * (n - 1) * (n - 1);
  while (le + 2 < ri) {
    long long m1 = le + (ri - le) / 3, m2 = le + 2 * (ri - le) / 3;
    long long fm1 = f(m1, c1, c2, ones, zeros),
              fm2 = f(m2, c1, c2, ones, zeros);
    if (fm1 < fm2)
      ri = m2 - 1;
    else if (fm1 > fm2)
      le = m1 + 1;
    else {
      le = m1;
      ri = m2;
    }
  }
  for (long long k = le; k <= ri; k++)
    ans = min(ans, f(k, c1, c2, ones, zeros));
  cout << ans;
  return 0;
}
