#include <bits/stdc++.h>
using namespace std;
int n, c1, c2;
int num_kids, num_adu;
string s;
long long v[200005];
long long cost(int x) { return c1 + (long long)c2 * (x - 1) * (x - 1); }
long long val(int g) {
  int rem = (num_kids + num_adu) - g;
  int num_per_group = rem / g + 1;
  int overflow = rem % g;
  return (long long)(g - overflow) * cost(num_per_group) +
         (long long)overflow * cost(num_per_group + 1);
}
int main() {
  cin >> n >> c1 >> c2;
  cin >> s;
  for (int i = 0; i < n; i++) {
    num_kids += (s[i] == '1' ? 0 : 1);
    num_adu += (s[i] == '1' ? 1 : 0);
  }
  for (int i = 1; i <= num_adu; i++) v[i - 1] = val(i);
  long long min = (long long)1e18;
  for (int i = 0; i < num_adu; i++)
    if (v[i] < min) min = v[i];
  cout << min << endl;
}
