#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")
using namespace std;
const long long inf = 1e18;
const long long mod = 1e9 + 7;
const long double fi = (sqrtl(5) + 1) / 2;
const long double eps = 1e-6;
long long cnt(long long x, long long c1, long long c2) {
  if (x == 0) return 0;
  return (c1 + c2 * (x - 1) * (x - 1));
}
long long count(long long n, long long x, long long c1, long long c2) {
  long long big = n % x;
  long long small = x - big;
  return big * cnt(n / x + 1, c1, c2) + small * cnt(n / x, c1, c2);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, c1, c2, l = 1, r = 0, m1, m2;
  cin >> n >> c1 >> c2;
  string s;
  cin >> s;
  for (char t : s) r += (long long)(t == '1');
  long long ans = 1e18, p = 0;
  for (long long i = l; i <= r; i++)
    if (count(n, i, c1, c2) < ans) {
      p = i;
      ans = count(n, i, c1, c2);
    }
  cout << ans << '\n';
  return 0;
}
