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.util.*;

public class D {
	private static Reader reader = new Reader();
	private static PrintWriter writer = new PrintWriter(System.out);

	public static void main(String[] args) throws IOException {
		int n = reader.readInt();
		int k = reader.readInt();
		int[] a = new int[n];
		ArrayList<ArrayList<Integer>> num_digit = new ArrayList<>(11);
		for (int i = 0; i < 11; i++) {
			num_digit.add(new ArrayList<>());
		}
		for (int i = 0; i < n; i++) {
			a[i] = reader.readInt();
			num_digit.get(getNumberOfDigits(a[i])).add(a[i] % k);
		}
		for (int i = 0; i < 11; i++) {
			Collections.sort(num_digit.get(i));
		}
		long ans = 0;
		for (int i = 0; i < n; i++) {
			int my_digits = getNumberOfDigits(a[i]);
			for (int digits = 1; digits < 11; digits++) {
				long ten = ten_pow(digits) % k;
				int mod = a[i] % k;
				int num_mod = (int)((ten * mod) % k);
				int rem_mod = (k - num_mod) % k;
				ans += getCountOfElementsWithMod(num_digit.get(digits), rem_mod);
				if (my_digits == digits && mod == rem_mod) {
					ans--;
				}
			}
		}
		writer.println(ans);
		reader.close();
		writer.close();
	}
	
	private static long ten_pow(int x) {
		long ten = 1;
		for (int p = 0; p < x; p++) {
			ten *= 10;
		}
		return ten;
	}
	
	private static int getNumberOfDigits(int num) {
		int digits = 1;
		while (num > 9) {
			digits++;
			num /= 10;
		}
		return digits;
	}
	
	private static int getCountOfElementsWithMod(ArrayList<Integer> a, int mod) {
		int l = firstIndexOf(a, mod);
		int r = lastIndexOf(a, mod);
		if (l != -1 && r != -1) {
			return r - l + 1;
		}
		return 0;
	}
	
	private static int firstIndexOf(ArrayList<Integer> a, int key) {
		int l = 0;
		int r = a.size() - 1;
		int res = -1;
		while (l <= r) {
			int m = (l + r) >> 1;
		    int ele = a.get(m);
		    if (ele == key) {
		    	res = m;
		    	r = m - 1;
		    } else if (ele < key) {
		    	l = m + 1;
		    } else {
		    	r = m - 1;
		    }
		}
		return res;
	}
	
	private static int lastIndexOf(ArrayList<Integer> a, int key) {
		int l = 0;
		int r = a.size() - 1;
		int res = -1;
		while (l <= r) {
			int m = (l + r) >> 1;
		    int ele = a.get(m);
		    if (ele == key) {
		    	res = m;
		    	l = m + 1;
		    } else if (ele < key) {
		    	l = m + 1;
		    } else {
		    	r = m - 1;
		    }
		}
		return res;
	}

	static class Reader {
		final private int BUFFER_SIZE = 1 << 16;
		private DataInputStream input;
		private byte[] buffer;
		private int bufferPointer, bytesRead;

		public Reader() {
			this(System.in);
		}

		public Reader(String fileName) throws FileNotFoundException {
			this(new FileInputStream(fileName));
		}

		public Reader(InputStream inputStream) {
			input = new DataInputStream(inputStream);
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}

		public String readString() throws IOException {
			byte c = read();
			while (c <= ' ') {
				c = read();
			}
			StringBuilder string = new StringBuilder();
			do {
				if (Character.isValidCodePoint(c)) {
					string.appendCodePoint(c);
				}
				c = read();
			} while (!isWhitespace(c));
			return string.toString();
		}

		public int readInt() throws IOException {
			int result = 0;
			byte c = read();
			while (c <= ' ') {
				c = read();
			}
			boolean isNegative = (c == '-');
			if (isNegative) {
				c = read();
			}
			do {
				result = result * 10 + c - '0';
			} while ((c = read()) >= '0' && c <= '9');

			if (isNegative) {
				return -result;
			}
			return result;
		}

		public long readLong() throws IOException {
			long result = 0;
			byte c = read();
			while (c <= ' ') {
				c = read();
			}
			boolean isNegative = (c == '-');
			if (isNegative) {
				c = read();
			}
			do {
				result = result * 10 + c - '0';
			} while ((c = read()) >= '0' && c <= '9');

			if (isNegative) {
				return -result;
			}
			return result;
		}

		public double readDouble() throws IOException {
			double result = 0, div = 1;
			byte c = read();
			while (c <= ' ') {
				c = read();
			}
			boolean isNegative = (c == '-');
			if (isNegative) {
				c = read();
			}
			do {
				result = result * 10 + c - '0';
			} while ((c = read()) >= '0' && c <= '9');

			if (c == '.') {
				while ((c = read()) >= '0' && c <= '9') {
					result += (c - '0') / (div *= 10);
				}
			}
			if (isNegative) {
				return -result;
			}
			return result;
		}

		private boolean isWhitespace(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		private void fillBuffer() throws IOException {
			bytesRead = input.read(buffer, bufferPointer = 0, BUFFER_SIZE);
			if (bytesRead == -1)
				buffer[0] = -1;
		}

		private byte read() throws IOException {
			if (bufferPointer == bytesRead) {
				fillBuffer();
			}
			return buffer[bufferPointer++];
		}

		public void close() throws IOException {
			if (input == null) {
				return;
			}
			input.close();
		}

	}

}
