#include <bits/stdc++.h>
using namespace std;
long long c1, c2;
int n, k;
long long p(long long m) {
  long long mini = LLONG_MAX;
  for (int i = 1; i <= n; ++i)
    if ((n + i) / (i + 1) <= m and m <= n / i)
      mini = min(mini, 1LL * i * i * (m * (i + 1) - n) +
                           1LL * (i + 1) * (i + 1) * (n - m * i));
  return m * (c1 + c2) - 2 * c2 * n + c2 * mini;
}
int main() {
  scanf("%d %lld %lld%*c", &n, &c1, &c2);
  for (int i = 0; i < n; ++i) k += getchar() == '1';
  int lo = 1, hi = k;
  while (lo < hi) {
    int mid = lo + (hi - lo) / 2;
    if (p(mid) <= p(mid + 1))
      hi = mid;
    else
      lo = mid + 1;
  }
  printf("%lld\n", p(lo));
  return 0;
}
