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 flag[90 * 4400];
char str[4400];
int sum;
int pre[4400];
int que[4400 * 4400];
int Cnt;
int main() {
  scanf("%d", &sum);
  scanf("%s", str);
  memset(flag, 0, sizeof(flag));
  int len = strlen(str);
  pre[0] = 0;
  int i, j;
  for (i = 0; i < len; i++) pre[i + 1] = pre[i] + (str[i] - '0');
  int now;
  for (i = 1; i <= len; i++) {
    for (j = 0; j < i; j++) {
      now = pre[i] - pre[j];
      if (!flag[now]) que[Cnt++] = now;
      flag[now]++;
    }
  }
  long long ret = 0;
  for (i = 0; i < Cnt; i++) {
    if (!que[i]) {
      if (0 == sum)
        ret +=
            (long long)flag[0] * (len + 1) * len - (long long)flag[0] * flag[0];
    } else {
      if (sum && sum % que[i] == 0 && sum / que[i] < 90 * 4400) {
        ret += ((long long)flag[que[i]] * flag[sum / que[i]]);
      }
    }
  }
  cout << ret << endl;
  return 0;
}
