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 s[40010];
long long sums[40010];
long long cnt[40010];
long long rangeSum[40010];
int main() {
  int i, j;
  long long a, length;
  while (scanf("%I64d%s", &a, s) != EOF) {
    memset(rangeSum, 0, sizeof(rangeSum));
    memset(cnt, 0, sizeof(cnt));
    length = strlen(s);
    for (i = 0; i < length; i++) {
      if (i == 0)
        sums[i] = (s[i] - '0');
      else
        sums[i] = sums[i - 1] + (s[i] - '0');
    }
    for (i = 0; i < length; i++)
      for (j = i; j < length; j++) {
        long long tempSum = sums[j];
        if (i > 0) tempSum -= sums[i - 1];
        rangeSum[tempSum]++;
        cnt[tempSum]++;
      }
    if (a == 0) {
      long long ans = (length + 1) * length / 2 * cnt[0];
      ans += cnt[0] * ((length + 1) * length / 2 - cnt[0]);
      printf("%I64d\n", ans);
    } else {
      long long ans = 0;
      for (i = 1; i <= 40000; i++) {
        if (rangeSum[i] > 0) {
          if (a % i == 0) {
            long long tempValue = a / i;
            if (tempValue <= 40000) ans += cnt[tempValue] * rangeSum[i];
          }
        }
      }
      printf("%I64d\n", ans);
    }
  }
  return 0;
}
