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;
int suff[4010];
char str[4010];
int pr[4010];
int N;
int ways(int sum) {
  int i, j, ct;
  ct = 0;
  j = N;
  for (i = N - 1; i >= 0; --i) {
    while (j > i && suff[i] - suff[j] > sum) --j;
    if (suff[i] - suff[j] == sum) ct += j - max(i, pr[j]);
  }
  return ct;
}
int A;
int main() {
  int i;
  scanf("%d", &A);
  scanf("%s", str);
  N = strlen(str);
  for (i = N - 1; i >= 0; --i) {
    suff[i] = suff[i + 1] + str[i] - '0';
  }
  pr[0] = -1;
  for (i = 1; i <= N; ++i) {
    pr[i] = str[i - 1] != '0' ? i - 1 : pr[i - 1];
  }
  long long sol = 0;
  int c1, c2;
  for (i = 1; i * i <= A; ++i) {
    if (A % i) continue;
    c1 = ways(i);
    c2 = ways(A / i);
    sol += 1LL * c1 * c2;
    if (i != A / i) sol += 1LL * c1 * c2;
  }
  if (!A) {
    c1 = ways(0);
    c2 = (N * (N + 1)) / 2;
    sol += 2LL * c1 * c2 - (c1 * 1LL * c1);
  }
  cout << sol << "\n";
  return 0;
}
