You are given an array a, consisting of n positive integers.

Let's call a concatenation of numbers x and y the number that is obtained by writing down numbers x and y one right after another without changing the order. For example, a concatenation of numbers 12 and 3456 is a number 123456.

Count the number of ordered pairs of positions (i, j) (i ≠ j) in array a such that the concatenation of a_i and a_j is divisible by k.

Input

The first line contains two integers n and k (1 ≤ n ≤ 2 ⋅ 10^5, 2 ≤ k ≤ 10^9).

The second line contains n integers a_1, a_2, ..., a_n (1 ≤ a_i ≤ 10^9).

Output

Print a single integer — the number of ordered pairs of positions (i, j) (i ≠ j) in array a such that the concatenation of a_i and a_j is divisible by k.

Examples

Input

6 11
45 1 10 12 11 7


Output

7


Input

4 2
2 78 4 10


Output

12


Input

5 2
3 7 19 3 3


Output

0

Note

In the first example pairs (1, 2), (1, 3), (2, 3), (3, 1), (3, 4), (4, 2), (4, 3) suffice. They produce numbers 451, 4510, 110, 1045, 1012, 121, 1210, respectively, each of them is divisible by 11.

In the second example all n(n - 1) pairs suffice.

In the third example no pair is sufficient.
import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class D implements Runnable{
	public static void main (String[] args) {new Thread(null, new D(), "_cf", 1 << 28).start();}

	public void run() {
		FastScanner fs = new FastScanner();
//		try { fs = new FastScanner("testdata.out"); } catch (Exception e) {}
		PrintWriter out = new PrintWriter(System.out);
		System.err.println("Go!");

//		long start = System.nanoTime();
		int n = fs.nextInt();
		int k = fs.nextInt();
		long res = 0;
		HashMap<Integer, HashSet<Integer>>[] maps = new HashMap[11];
		for(int i = 0; i < 11; i++) maps[i] = new HashMap<>();
		int[] a = fs.nextIntArray(n);
		for(int i = 0; i < n; i++) {
			int len = len(a[i]);
			int mod = a[i] % k;
			if(!maps[len].containsKey(mod)) {
				maps[len].put(mod, new HashSet<>());
			}
			maps[len].get(mod).add(i);
		}
		long[] pow10 = new long[15];
		pow10[0] = 1;
		BigInteger K = BigInteger.valueOf(k);
		for(int i = 1; i < pow10.length; i++) pow10[i] = 10L * pow10[i-1];
		for(int i = 0; i < n; i++) {
			int len = len(a[i]);
			for(int p = 1; p < 11; p++) {
				if(len+p > 18) {
					BigInteger bi = BigInteger.valueOf(a[i]).multiply(BigInteger.valueOf(pow10[p]));
					int need = K.subtract(bi.mod(K)).mod(K).intValue();
					if(maps[p].containsKey(need)) {
						res += maps[p].get(need).size();
						if(maps[p].get(need).contains(i)) res--;
					}
					continue;
				}
				long me = pow10[p]*a[i];
				int need = (int)((k - (me%k))%k);
				if(maps[p].containsKey(need)) {
					res += maps[p].get(need).size();
					if(maps[p].get(need).contains(i)) res--;
				}
			}
		}
		
		out.println(res);
//		out.println((System.nanoTime()-start)/1000000);
		out.close();
	}
	
	int len(int a) {
		int res = 0;
		while(a > 0) {
			res++;
			a /= 10;
		}
		return res;
	}

	void sort (int[] a) {
		int n = a.length;
		for(int i = 0; i < 50; i++) {
			Random r = new Random();
			int x = r.nextInt(n), y = r.nextInt(n);
			int temp = a[x];
			a[x] = a[y];
			a[y] = temp;
		}
		Arrays.sort(a);
	}

	class FastScanner {
		public int BS = 1<<16;
		public char NC = (char)0;
		byte[] buf = new byte[BS];
		int bId = 0, size = 0;
		char c = NC;
		double num = 1;
		BufferedInputStream in;

		public FastScanner() {
			in = new BufferedInputStream(System.in, BS);
		}

		public FastScanner(String s) throws FileNotFoundException {
			in = new BufferedInputStream(new FileInputStream(new File(s)), BS);
		}

		public char nextChar(){
			while(bId==size) {
				try {
					size = in.read(buf);
				}catch(Exception e) {
					return NC;
				}                
				if(size==-1)return NC;
				bId=0;
			}
			return (char)buf[bId++];
		}

		public int nextInt() {
			return (int)nextLong();
		}

		public long nextLong() {
			num=1;
			boolean neg = false;
			if(c==NC)c=nextChar();
			for(;(c<'0' || c>'9'); c = nextChar()) {
				if(c=='-')neg=true;
			}
			long res = 0;
			for(; c>='0' && c <='9'; c=nextChar()) {
				res = (res<<3)+(res<<1)+c-'0';
				num*=10;
			}
			return neg?-res:res;
		}

		public double nextDouble() {
			double cur = nextLong();
			return c!='.' ? cur:cur+nextLong()/num;
		}

		public String next() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c>32) {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public String nextLine() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c!='\n') {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public boolean hasNext() {
			if(c>32)return true;
			while(true) {
				c=nextChar();
				if(c==NC)return false;
				else if(c>32)return true;
			}
		}
		
		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for(int i = 0; i < n; i++) res[i] = nextInt();
			return res;
		}
		
	}

}