You have a string of decimal digits s. Let's define bij = si·sj. Find in matrix b the number of such rectangles that the sum bij for all cells (i, j) that are the elements of the rectangle equals a in each rectangle.

A rectangle in a matrix is a group of four integers (x, y, z, t) (x ≤ y, z ≤ t). The elements of the rectangle are all cells (i, j) such that x ≤ i ≤ y, z ≤ j ≤ t.

Input

The first line contains integer a (0 ≤ a ≤ 109), the second line contains a string of decimal integers s (1 ≤ |s| ≤ 4000).

Output

Print a single integer — the answer to a problem.

Please, do not write the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier.

Examples

Input

10
12345


Output

6


Input

16
439873893693495623498263984765


Output

40
#include <bits/stdc++.h>
const long long int INF = (1e9 + 9999812) * 2, MOD = 1e9 + 7, MAXN = 10000;
const long double EPS = 0.000000000001;
using namespace std;
long long int pref[4005];
int main() {
  long long int n;
  cin >> n;
  string s;
  cin >> s;
  pref[0] = 0;
  for (long long int i = 0; i < (long long int)s.size(); i++) {
    long long int sum = s[i] - '0';
    pref[i + 1] = pref[i] + sum;
  }
  long long int ans = 0;
  unordered_map<long long int, long long int> mm;
  long long int all = 0;
  for (long long int i = 0; i <= (long long int)s.size(); i++) {
    for (long long int j = i + 1; j <= (long long int)s.size(); j++) {
      long long int get1 = pref[j] - pref[i];
      mm[get1]++;
      all++;
    }
  }
  for (long long int i = 0; i <= (long long int)s.size(); i++) {
    for (long long int j = i + 1; j <= (long long int)s.size(); j++) {
      long long int get1 = pref[j] - pref[i];
      if (get1 == 0 && n == 0) {
        ans += all;
      } else if (get1 == 0) {
      } else if (n % get1 == 0) {
        ans += mm[n / get1];
      }
    }
  }
  cout << ans;
  return 0;
}
