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.text.BreakIterator;
import java.util.*;


public class Main {
    static class pair implements Comparable<pair>{
        int x;
        int idx;
        pair(int x,int idx){
            this.x=x;
            this.idx=idx;
        }

        @Override
        public int compareTo(pair p) {
            if(p.x==x){
                return idx-p.idx;
            }
            return x-p.x;
        }
        }


    public static long ciel(long x,long y){
        long res=x/y;
        if(x%y!=0)res++;
        return res;
    }

    public static long gcd(long u,long v){
        if(v==0)return u;
        return gcd(v, u%v);
    }
    static int  mod= (int) (1e9+7);
    static long memo[][];
    static long inf= (long) 2e9;
    static int[]cost,weight;
    static ArrayList<Integer> primes;
    static ArrayList<Integer> primeFactors(int N)		// O(sqrt(N) / ln sqrt(N))
    {
        ArrayList<Integer> factors = new ArrayList<Integer>();		//take abs(N) in case of -ve integers
        int idx = 0, p = primes.get(idx);

        while(p * p <= N)
        {
            while(N % p == 0) { factors.add(p); N /= p; }
            p = primes.get(++idx);
        }

        if(N != 1)						// last prime factor may be > sqrt(N)
            factors.add(N);				// for integers whose largest prime factor has a power of 1
        return factors;
    }
    static int[] isComposite;
    static void sieve(int N)	// O(N log log N)
    {
        isComposite = new int[N+1];
        isComposite[0] = isComposite[1] = 1;			// 0 indicates a prime number
        primes = new ArrayList<Integer>();

        for (int i = 2; i <= N; ++i) 					//can loop till i*i <= N if primes array is not needed O(N log log sqrt(N))
            if (isComposite[i] == 0) 					//can loop in 2 and odd integers for slightly better performance
            {
                primes.add(i);
                if(1l * i * i <= N)
                    for (int j = i * i; j <= N; j += i)	// j = i * 2 will not affect performance too much, may alter in modified sieve
                        isComposite[j] = 1;
            }
    }

    /*
     * 2. Primality Test
     *
     *  Preprocessing: call sieve with sqrt(N), O(sqrt(N) log log sqrt(N))
     *  Query: best case O(1), worst case O(sqrt(N) / log sqrt(N))
     */
    static boolean isPrime(int N)
    {
        if(N < isComposite.length)
            return isComposite[N] == 0;
        for(int p: primes)					//may stop if p * p > N
            if(N%p==0)
                return false;
        return true;
    }
    static long modPow(long a, long e, long mod)	// O(log e)
    {
        a %= mod;
        long res = 1;
        while(e > 0)
        {
            if((e & 1) == 1)
                res = (res * a) % mod;
            a = (a * a) % mod;
            e >>= 1;
        }
        return res;
    }
    public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        PrintWriter pw=new PrintWriter(System.out);
        int n=sc.nextInt();
        long k=sc.nextInt();
        long[]Arr=new long[n];
        HashMap<Integer,Integer>[]adj=new HashMap[11];
        for(int i=0;i<11;i++)adj[i]=new HashMap();

        for(int i=0;i<n;i++) {
            Arr[i] = sc.nextInt();
            int x=(Arr[i]+"").length();
            int mod= (int) (Arr[i]%k);
            adj[x].put(mod,adj[x].getOrDefault(mod,0)+1);
        }

        long ans=0;
        for(int zero=1;zero<=10;zero++){

            for(int i=0;i<n;i++){
              long y=modPow(10, zero, k)*Arr[i];
              long mod=y%k;
                ans += adj[zero].getOrDefault((int)((k-mod)%k), 0);
                if(zero==(""+Arr[i]).length()&&(Arr[i]%k==(int)((k-mod)%k)))
                    ans--;
            }
        }
        System.out.println(ans);
    }

    public static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        public String nextLine() throws IOException {
            return br.readLine();
        }

        public double nextDouble() throws IOException {
            String x = next();
            StringBuilder sb = new StringBuilder("0");
            double res = 0, f = 1;
            boolean dec = false, neg = false;
            int start = 0;
            if (x.charAt(0) == '-') {
                neg = true;
                start++;
            }
            for (int i = start; i < x.length(); i++)
                if (x.charAt(i) == '.') {
                    res = Long.parseLong(sb.toString());
                    sb = new StringBuilder("0");
                    dec = true;
                } else {
                    sb.append(x.charAt(i));
                    if (dec)
                        f *= 10;
                }
            res += Long.parseLong(sb.toString()) / f;
            return res * (neg ? -1 : 1);
        }

        public boolean ready() throws IOException, IOException {
            return br.ready();
        }

    }
}