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.BufferedReader;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Arrays;
import java.util.Comparator;
import java.util.StringTokenizer;
import java.util.ArrayList;
import java.util.Collections;
import java.math.*;
 
 
public class Main {
    public static void main(String[] args) throws IOException {
        PrintWriter out = new PrintWriter(System.out);
        //Scanner sc = new Scanner();
        Reader in = new Reader();
        Main solver = new Main();
        solver.solve(out, in);
        out.flush();
        out.close();
 
    }
    static int mod = (int)1e9+7;
 
    void solve(PrintWriter out, Reader in) throws IOException{   
        int n = in.nextInt();
        k = in.nextInt();
        
        
        int[] arr = new int[n];
        ArrayList<Integer> rem[] = new ArrayList[11];
        for(int j=1;j<11;j++)   rem[j] = new ArrayList<Integer>();
        
        for(int i=0 ;i<n ;i++) {
            arr[i] = in.nextInt();
            
            
            for(int j=1;j<11;j++){
                rem[j].add((int)(((long)Math.pow(10,j)%k)*(arr[i])%k)%k);
            }
        }
        for(int i=1;i<11;i++) Collections.sort(rem[i]);
        int u=0,v=0;
        long ans=0L;
        
        
        for(int i=0;i<n ;i++){
            u = first(rem[(arr[i]+"").length()],k-(arr[i])%k);
            v = last(rem[(arr[i]+"").length()],k-(arr[i])%k);
            if(((arr[i]%k)+(int)((((long)Math.pow(10,(arr[i]+"").length())%k)*(arr[i]%k))%k))%k==0) ans--;
            if(u==-1) continue;
            ans+= v-u+1;
        }
        
        
        out.println(ans);
        
    }
    
    static int k;
    static int last(ArrayList<Integer> list,int x){
        int hi= list.size()-1,lo=0;
        int r =-1;
        
        if(k==x) x=0;
        int e;
        while(lo<=hi){
            int mid = (hi+lo)/2;
            e = list.get(mid);
            if(e<x) {
                lo = mid+1;
            }else if(e==x){
                lo = mid+1;
                r = mid;
            }else hi = mid-1;
        }
        return r;
    }
    
    static int first(ArrayList<Integer> list,int x){
        int hi= list.size()-1,lo=0;
        int r =-1;
        
        if(k==x) x=0;
        int e;
        while(lo<=hi){
            int mid = (hi+lo)/2;
            e = list.get(mid);
            if(e<x) {
                lo = mid+1;
            }else if(e==x){
                hi = mid-1;
                r = mid;
            }else hi = mid-1;
        }
        return r;
    }
    
    static class Node implements Comparable<Node>{
        int pos;
        boolean left;
 
        Node(int pos,boolean left){
            this.pos = pos;
            this.left = left;
        }
 
        @Override
        public int compareTo(Node o){
            if(this.pos!=o.pos) return this.pos-o.pos;
            else {
                if(this.left==o.left) return 0;
                else return (this.left ? -1:1);
            }
        }
    }
 
    static class Reader {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;
 
        public Reader()
        {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }
 
        public Reader(String file_name) throws IOException
        {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }
 
        public String readLine() throws IOException
        {
            byte[] buf = new byte[64]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1)
            {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }
 
        public int nextInt() throws IOException
        {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do
            {
                ret = ret * 10 + c - '0';
            }  while ((c = read()) >= '0' && c <= '9');
 
            if (neg)
                return -ret;
            return ret;
        }
 
        public long nextLong() throws IOException
        {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }
 
        public double nextDouble() throws IOException
        {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
 
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
 
            if (c == '.')
            {
                while ((c = read()) >= '0' && c <= '9')
                {
                    ret += (c - '0') / (div *= 10);
                }
            }
 
            if (neg)
                return -ret;
            return ret;
        }
 
        private void fillBuffer() throws IOException
        {
            bytesRead = din.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 (din == null)
                return;
            din.close();
        }
    }
 
    static class Scanner  {
        BufferedReader br;
        StringTokenizer st;
 
        public Scanner()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }
 
        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
 
        int nextInt()
        {
            return Integer.parseInt(next());
        }
 
        long nextLong()
        {
            return Long.parseLong(next());
        }
 
        double nextDouble()
        {
            return Double.parseDouble(next());
        }
 
        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}
