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.util.*;
import java.util.stream.*;
import java.util.function.*;
import java.io.*;
import java.math.*;
import java.awt.geom.*;
import static java.util.Comparator.*;
import static java.lang.Math.*;
public class Main {
  public static final PrintWriter outWriter = new PrintWriter(System.out);
  public static final int _BUFFER_SIZE = 1 << 16;
  public static final DataInputStream _din = new DataInputStream(System.in);
  public static final byte[] _buffer = new byte[_BUFFER_SIZE];
  public static int _bufferPointer = 0, _bytesRead = 0;
  public static abstract class MultisetBase<E> {
    abstract Map<E,Integer> map();
    abstract MultisetBase<E> copy();
    Integer add(E obj) { return add(obj, 1); }
    Integer add(E obj, int n) { return map().merge(obj,n,Integer::sum); }
    Integer get(E obj) { return map().getOrDefault(obj, 0); }
    Integer removeAll(E obj) { return map().remove(obj); }
    Integer remove(E obj) { return remove(obj, -1); }
    Integer remove(E obj, int n) { return map().merge(obj,n,(a,b)->a+b == 0 ? null : a+b); }
    void clear() { map().clear(); }
    int size() { return map().values().stream().reduce(0, Integer::sum); }
    int nUnique() { return map().size(); }
    Set<Map.Entry<E,Integer>> entrySet() { return map().entrySet(); }
    Collection<E> keySet() { return map().keySet(); }
    Collection<Integer> values() { return map().values(); }
    @Override
    public boolean equals(Object o) { return o instanceof MultisetBase && map().equals(((MultisetBase)o).map()); }
    @Override
    public int hashCode() { return map().hashCode(); }
    @Override
    public String toString() { return map().toString(); }
  }
  public static class Multiset<E> extends MultisetBase<E> {
    HashMap<E,Integer> map = new HashMap<E,Integer>();
    HashMap<E,Integer> map() { return map; }
    Multiset() {}
    Multiset(Map<E, Integer> map_) { map = new HashMap<E,Integer>(map_); }
    Multiset<E> copy() { return new Multiset<E>(map()); }
  }
  public static final long[] POW_10 = {1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000, 10000000000L, 100000000000L, 1000000000000L};
  public static int ndigits(int number) {
    if (number < 100000) {
      if (number < 100) {
        if (number < 10) {
          return 1;
        } else {
          return 2;
        }
      } else {
        if (number < 1000) {
          return 3;
        } else {
          if (number < 10000) {
            return 4;
          } else {
            return 5;
          }
        }
      }
    } else {
      if (number < 10000000) {
        if (number < 1000000) {
          return 6;
        } else {
          return 7;
        }
      } else {
        if (number < 100000000) {
          return 8;
        } else {
          if (number < 1000000000) {
            return 9;
          } else {
            return 10;
          }
        }
      }
    }
  }
  public static void main() {
    int n = nextInt(), k = nextInt();
    ArrayList<Multiset<Integer>> lowerRems = new ArrayList<Multiset<Integer>>();
    for (int i = 0; i < POW_10.length; i++) {
      lowerRems.add(new Multiset<Integer>());
    }
    int[] as = new int[n];
    for (int i = 0; i < as.length; i++) {
      as[i] = nextInt();
    }
    for (int i : as) {
      lowerRems.get(ndigits(i)).add(i%k);
    }
    long out = 0;
    for (int i : as) {
      int ndigits = ndigits(i);
      for (int pow = 0; pow < POW_10.length; pow++) {
        int compliment = (k - (int)((i%k)*(POW_10[pow]%k)%k))%k;
        out += lowerRems.get(pow).get(compliment);
        if (ndigits == pow && i%k == compliment) {
          out--;
        }
      }
    }
    outWriter.println(out);
  }
  public static void main(String[] args) { main(); outWriter.flush(); }
  public static void _fillBuffer() {
    try {
      _bytesRead = _din.read(_buffer, _bufferPointer = 0, _buffer.length);
      if (_bytesRead == -1) {
        _buffer[0] = -1;
        throw new UncheckedIOException(new IOException("end of stream"));
      }
    } catch (IOException e) {
      throw new UncheckedIOException(e);
    }
  }
  public static byte _read() {
    if (_bufferPointer == _bytesRead)
      _fillBuffer();
    return _buffer[_bufferPointer++];
  }
  public static String next() {
    byte[] strBuf = new byte[64];
    int cnt = 0, c;
    while ((c = _read()) != -1) {
      if (Character.isWhitespace(c)) {
        if (cnt == 0) {
          continue;
        } else {
          break;
        }
      }
      if (strBuf.length == cnt) {
        strBuf = Arrays.copyOf(strBuf, strBuf.length*2);
      }
      strBuf[cnt++] = (byte) c;
    }
    return new String(strBuf, 0, cnt);
  }
  public static String nextLine() {
    byte[] strBuf = new byte[64];
    int cnt = 0, c;
    while ((c = _read()) != -1) {
      if (c == '\n') {
        if (cnt == 0) {
          continue;
        } else {
          break;
        }
      }
      if (strBuf.length == cnt) {
        strBuf = Arrays.copyOf(strBuf, strBuf.length*2);
      }
      strBuf[cnt++] = (byte) c;
    }
    return new String(strBuf, 0, cnt);
  }
  public static int nextInt() {
    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 static long nextLong() {
    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 static double nextDouble() {
    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;
  }
}
