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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Map;
import java.util.InputMismatchException;
import java.util.HashMap;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in Actual solution is at the top
 *
 * @author MaxHeap
 */
public class Main {

  public static void main(String[] args) {
    InputStream inputStream = System.in;
    OutputStream outputStream = System.out;
    InputReader in = new InputReader(inputStream);
    PrintWriter out = new PrintWriter(outputStream);
    TaskD solver = new TaskD();
    solver.solve(1, in, out);
    out.close();
  }

  static class TaskD {

    public void solve(int testNumber, InputReader in, PrintWriter out) {
      int n = in.nextInt();
      long k = in.nextLong();
      long[] arr = in.nextLongArray(n);
      int[] size = new int[n];
      long[] pow = new long[15];

      pow[0] = 1L;

      for (int i = 1; i <= 14; i++) {
        pow[i] = pow[i - 1] * 10L;
      }

      CountingMap<Long>[] map = new CountingMap[20];
      for (int i = 0; i < 20; i++) {
        map[i] = new CountingMap<>();
      }

      for (int i = 0; i < n; i++) {
        int cp = 0;
        long p = arr[i];
        while (p > 0) {
          ++cp;
          p /= 10;
        }
        size[i] = cp;
      }
      long ans = compute(n, k, arr, size, pow, map);
      ArrayUtils.reverse(size);
      ArrayUtils.reverse(arr);
      for (int i = 0; i < 20; i++) {
        map[i].clear();
      }
      ans += compute(n, k, arr, size, pow, map);
      out.println(ans);
    }

    private long compute(int n, long k, long[] arr, int[] size, long[] pow,
        CountingMap<Long>[] map) {
      long ans = 0;
      for (int i = 0; i < n; i++) {
        long cur = arr[i];
        for (int j = 1; j <= 10; j++) {
          long have = (cur * (pow[j] % k) % k);
          long need = (k - have) % k;
          if (map[j].containsKey(need)) {
            ans += map[j].get(need);
          }
        }
        map[size[i]].increment(arr[i] % k);
      }
      return ans;
    }

  }

  static class CountingMap<T> {

    private Map<T, Integer> map;

    public CountingMap() {
      map = new HashMap<>();
    }

    public void increment(T key) {
      incrementBy(key, 1);
    }

    public boolean containsKey(Object key) {
      return map.containsKey(key);
    }

    public void clear() {
      map.clear();
    }

    public void incrementBy(T key, Integer step) {
      map.put(key, map.getOrDefault(key, 0) + step);
    }

    public String toString() {
      return "CountingMap{" +
          "map=" + map +
          '}';
    }

    public int get(T val) {
      return map.get(val);
    }

  }

  static class ArrayUtils {

    public static void reverse(int[] arr) {
      for (int i = 0; i < arr.length / 2; i++) {
        int temp = arr[i];
        arr[i] = arr[arr.length - i - 1];
        arr[arr.length - i - 1] = temp;
      }
    }

    public static void reverse(long[] arr) {
      for (int i = 0; i < arr.length / 2; i++) {
        long temp = arr[i];
        arr[i] = arr[arr.length - i - 1];
        arr[arr.length - i - 1] = temp;
      }
    }

  }

  static class InputReader {

    private InputStream stream;
    private byte[] buf = new byte[1 << 13];
    private int curChar;
    private int numChars;

    public InputReader(InputStream stream) {
      this.stream = stream;
    }

    public int read() {
      if (this.numChars == -1) {
        throw new UnknownError();
      } else {
        if (this.curChar >= this.numChars) {
          this.curChar = 0;

          try {
            this.numChars = this.stream.read(this.buf);
          } catch (IOException ex) {
            throw new InputMismatchException();
          }

          if (this.numChars <= 0) {
            return -1;
          }
        }

        return this.buf[this.curChar++];
      }
    }

    public int nextInt() {
      int c;
      for (c = this.read(); isSpaceChar(c); c = this.read()) {
      }

      byte sgn = 1;
      if (c == 45) {
        sgn = -1;
        c = this.read();
      }

      int res = 0;

      while (c >= 48 && c <= 57) {
        res *= 10;
        res += c - 48;
        c = this.read();
        if (isSpaceChar(c)) {
          return res * sgn;
        }
      }

      throw new InputMismatchException();
    }

    public long nextLong() {
      int c;
      for (c = this.read(); isSpaceChar(c); c = this.read()) {
      }

      byte sgn = 1;
      if (c == 45) {
        sgn = -1;
        c = this.read();
      }

      long res = 0;

      while (c >= 48 && c <= 57) {
        res *= 10L;
        res += c - 48;
        c = this.read();
        if (isSpaceChar(c)) {
          return res * sgn;
        }
      }
      throw new InputMismatchException();
    }

    public static boolean isSpaceChar(int c) {
      return c == 32 || c == 10 || c == 13 || c == 9 || c == -1;
    }

    public long[] nextLongArray(int n) {
      long[] arr = new long[n];
      for (int i = 0; i < n; i++) {
        arr[i] = nextLong();
      }
      return arr;
    }

  }
}

