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.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.Scanner;

public class Main {

	static Scanner sc;
	static PrintWriter pw;
	static boolean debug = true;
	static final int d = '0';
	static int[] a = new int[6000];
	static int[] k = new int[60000];

	private static void halt() {
		sc.close();
		pw.close();
		Runtime.getRuntime().halt(0);
	}

	public static void main(String[] args) throws IOException {
		if (debug) {
			sc = new Scanner(System.in);
			pw = new PrintWriter(System.out);
		} else {
			sc = new Scanner(new File("input.txt"), "ISO-8859-1");
			pw = new PrintWriter(new File("output.txt"), "ISO-8859-1");
		}
		int n = sc.nextInt();
		String ss = sc.next();
		int m = ss.length();
		int k0 = 0;
		for (int i = 0; i < m; i++) {
			a[i+1] = ss.charAt(i)-d;
			if (a[i+1] == 0) k0++;
		}
		for (int i = 1; i <= m; i++) {
			int s = 0;
			for (int j = i; j <= m; j++) {
				s += a[j];
				k[s]++;
			}
		}
		if (n == 0) {
			pw.println(BigInteger.valueOf(k[0]).multiply(BigInteger.valueOf(m+1)).multiply(BigInteger.valueOf(m)).subtract(BigInteger.valueOf(k[0]).pow(2)));
			halt();
		}
		BigInteger ans = BigInteger.ZERO;
		for (int i = 1; i <= Math.min(n,50000); i++) {
			if (n % i != 0) continue;
			if (n / i > 50000) continue;
			ans = ans.add(BigInteger.valueOf(k[i]).multiply(BigInteger.valueOf(k[n / i])));
		}
		pw.println(ans);
		sc.close();
		pw.close();
	}
}