#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 5;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, c1, c2;
  cin >> n >> c1 >> c2;
  string s;
  cin >> s;
  long long cur, a = 0, b = 0;
  for (long long i = 0; i < n; i++) a += (s[i] == '1'), b += (s[i] == '0');
  long long ans = LLONG_MAX;
  for (long long i = 1; i <= a; i++) {
    cur = (i - n % i) * (c1 + c2 * (n / i - 1) * (n / i - 1)) +
          (n % i) * (c1 + c2 * (n / i) * (n / i));
    ans = min(ans, cur);
  }
  cout << ans;
}
