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
import java.util.Scanner;

public class Main {
	public static int A, N;
	public static String str;
	public static int[] a, prefixes;
	public static final int MAX = 40005;
	public static int[] counts;

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		A = s.nextInt();
		str = s.next();
		N = str.length();
		a = new int[N];
		counts = new int[MAX];
		for (int i = 0; i < N; i++) {
			a[i] = str.charAt(i) - '0';
		}
		prefixes = new int[N];
		prefixes[0] = a[0];
		for (int i = 1; i < N; i++) {
			prefixes[i] = prefixes[i - 1] + a[i];
		}
		int total = 0;
		for (int i = 0; i < N; i++) {
			for (int j = i; j < N; j++) {
				counts[sum(i, j)]++;
				total++;
			}
		}
		long res = 0;
		for (int i = 0; i < N; i++) {
			for (int j = i; j < N; j++) {
				int sum = sum(i, j);
				if (sum == 0) {
					if (A == 0) {
						res += total;
					}
				} else {
					if (A % sum == 0 && A / sum < MAX) {
						res += counts[A / sum];
					}
				}
			}
		}
		System.out.println(res);
	}

	public static int sum(int l, int r) {
		if (l == 0)
			return prefixes[r];
		return prefixes[r] - prefixes[l - 1];
	}
}