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>
using namespace std;
char str[4005];
int c_sum[4005];
int all[4005 * 4005];
int cnt[37000];
int zero[4005];
int read(int i, int j) {
  if (i == 0)
    return c_sum[j];
  else
    return c_sum[j] - c_sum[i - 1];
}
int main() {
  int i, l, k, j, sum, tot, el, mx, find, len;
  long long Ans = 0;
  char c;
  while (scanf("%d", &k) != EOF) {
    getchar();
    i = 0;
    while ((c = getchar()) != '\n') str[i++] = c;
    l = i;
    for (i = 0; i < l; i++) str[i] -= '0';
    c_sum[0] = str[0];
    for (i = 1; i < l; i++) c_sum[i] = c_sum[i - 1] + str[i];
    tot = 0;
    for (i = 0; i < 37000; i++) cnt[i] = 0;
    mx = 0;
    Ans = 0;
    for (i = 0; i < l; i++) {
      for (j = i; j < l; j++) {
        sum = read(i, j);
        all[tot++] = sum;
        cnt[sum]++;
        mx = max(mx, sum);
      }
    }
    for (i = 0; i < tot; i++) {
      el = all[i];
      if (all[i] == 0) {
        if (k == 0) Ans += (long long)(tot);
        continue;
      }
      if (k % all[i]) continue;
      find = k / all[i];
      if (find > mx) continue;
      Ans += (long long)cnt[find];
    }
    cout << Ans << endl;
  }
  return 0;
}
