n,k,t = map(int,input().split())

x = t/100

u = n*k
d=[]

if k*n/u<=t/100:
    print(*([k]*n))
else:
    for i in range(1,n):
        a=k*i
        if a/u<x:
            #print(a/u,x)
            d.append(k)
        else:
            if a/u==x:
                d.append(k)
                print(*(d+[0]*(n-len(d))))
                break
            else:
                a-=k
                for j in range(1,k+1):
                    if (a+j)/u<=x<(a+j+1)/u:
                        d.append(j)
                        break

                print(*(d+(n-len(d))*[0]))
                break


n,k,t = map(int,input().split())

x = t/100

u = n*k
d=[]

if k*n/u<=t/100:
    print(*([k]*n))
else:
    for i in range(1,n+1):
        a=k*i
        if a/u<x:
            #print(a/u,x)
            d.append(k)
        else:
            if a/u==x:
                d.append(k)
                print(*(d+[0]*(n-len(d))))
                break
            else:
                a-=k
                for j in range(1,k+1):
                    if (a+j)/u<=x<(a+j+1)/u:
                        d.append(j)
                        break

                print(*(d+(n-len(d))*[0]))
                break


a,b,c=map(int,input().split())
z=[0]*a
for i in range(a):
    ok=0
    for j in range(b,-1,-1):
        if (sum(z)+j)/(a*b)<=c/100 :ok=j;break
    z[i]=ok
    if ok!=b:break
p=0
for i in range(a):
    if (sum(z)+1)/(a*b)==c/100:z[i]=0;p+=1
z[:p]=[]
z+=[0]*p
print(z)


a,b,c=map(int,input().split())
z=(a*b*c)//100
for i in range(a):
    if z>=b:print(b);z-=b
    else:print(z);z-=z


a,b,c=map(int,input().split())
z=[0]*a
for i in range(a):
    ok=0
    for j in range(b,-1,-1):
        if (sum(z)+j)/(a*b)<=c/100 :ok=j;break
    z[i]=ok
    if ok!=b:break
p=0
for i in range(a):
    if (sum(z)+1)/(a*b)==c/100:z[i]=0;p+=1
z[:p]=[]
z+=[0]*p
print(*z)


n,k,t=map(int,input().split())
a=int((n*k*t)/100)
i=int(a/k)
j=a%k
one=str(k)+" "
if j==0:
    print(one*i + (str(0)+" ")*(n-i))
else:

    print(one*i+ str(j)+ " "+ (str(0)+" ")*(n-i-1))


n,k,t=map(int,input().split())
a=int((n*k*t)/100)
i=int(a/k)
j=a%k
one=str(k)+" "
print(one*i+ str(j)+ " "+ (str(0)+" ")*(n-i-1))


# Andrewid the Android is a galaxy-famous detective. In his free time he likes to think about strings containing zeros and ones.

# Once he thought about a string of length n consisting of zeroes and ones. Consider the following operation: we choose any two adjacent positions in the string, and if one them contains 0, and the other contains 1, then we are allowed to remove these two digits from the string, obtaining a string of length n - 2 as a result.

# Now Andreid thinks about what is the minimum length of the string that can remain after applying the described operation several times (possibly, zero)? Help him to calculate this number.

# Input
# First line of the input contains a single integer n (1 ≤ n ≤ 2·105), the length of the string that Andreid has.

# The second line contains the string of length n consisting only from zeros and ones.

# Output
# Output the minimum length of the string that may remain after applying the described operations several times.

# Examples
# inputCopy
# 4
# 1100
# outputCopy
# 0
# inputCopy
# 5
# 01010
# outputCopy
# 1
# inputCopy
# 8
# 11101111
# outputCopy
# 6
# Note
# In the first sample test it is possible to change the string like the following: .

# In the second sample test it is possible to change the string like the following: .

# In the third sample test it is possible to change the string like the following: .
def apply_operation(n,strg):
    if n==1:
        return 1
    arr = []
    for i in strg:
        if len(arr)==0:
            arr.append(i)
        else:
            if i!=arr[-1]:
                arr.pop()
            else:
                arr.append(i)
    return len(arr)
n = int(input())
strg = input()
# n = 8
# strg = "11101111"
print(apply_operation(n,strg))


# Andrewid the Android is a galaxy-famous detective. In his free time he likes to think about strings containing zeros and ones.

# Once he thought about a string of length n consisting of zeroes and ones. Consider the following operation: we choose any two adjacent positions in the string, and if one them contains 0, and the other contains 1, then we are allowed to remove these two digits from the string, obtaining a string of length n - 2 as a result.

# Now Andreid thinks about what is the minimum length of the string that can remain after applying the described operation several times (possibly, zero)? Help him to calculate this number.

# Input
# First line of the input contains a single integer n (1 ≤ n ≤ 2·105), the length of the string that Andreid has.

# The second line contains the string of length n consisting only from zeros and ones.

# Output
# Output the minimum length of the string that may remain after applying the described operations several times.

# Examples
# inputCopy
# 4
# 1100
# outputCopy
# 0
# inputCopy
# 5
# 01010
# outputCopy
# 1
# inputCopy
# 8
# 11101111
# outputCopy
# 6
# Note
# In the first sample test it is possible to change the string like the following: .

# In the second sample test it is possible to change the string like the following: .

# In the third sample test it is possible to change the string like the following: .
def apply_operation(n,strg):
    if n==1:
        return 1
    arr = []
    for i in strg:
        if len(arr)==0:
            arr.append(i)
        else:
            if i!=arr[-1]:
                arr.pop()
            else:
                arr.append(i)
    return len(arr)
n = int(input())
strg = input()
# n = 8
# strg = "11101111"
apply_operation(n,strg)


n=int(input())
s=input()
p=[s.count('1'),s.count('0')]
print(abs(p[0]-p[1]))


n = input()
num_zero = 0
num_one = 0
for i in n:
    if i == '0':
        num_zero += 1
    else:
        num_one += 1

x = min(num_one,num_zero)
print(len(n) - 2*x)


z = int(input())
n = input()
num_zero = 0
num_one = 0
for i in n:
    if i == '0':
        num_zero += 1
    else:
        num_one += 1

x = min(num_one,num_zero)
print(z - 2*x)


n = int(input())
s = list(input())
print(abs(s.count('0')-s.count('1')))


n = int(input())
s = list(input())
b = len(s)
for i in range(n-1):
    if s[i] == '1' and s[i+1]=='0':
        b -= 2

print(b)


luv=input()
cf=input()
onegod=0
zerogod=0
for I in cf:
    if I=='1':

        onegod += 1

zerogod = len(cf)-onegod
print(abs(onegod-zerogod))


n=int(input())
u=input()
z=0
k=0
if n==1:
    print(1)###
else:
    for i in range(n):
        if u[i]=="1":
            z+=1
        else:
            k+=1
    kk=min(z,k)###
    uu=max(z,k)
    print(uu-kk)


n=int(input())
u=input()
z=0
k=0
if n==1:
    print(0)
else:
    for i in range(n):
        if u[i]=="1":
            z+=1
        else:
            k+=1
    kk=min(z,k)###
    uu=max(z,k)
    print(uu-kk)


n = int(input())
s = input()
print(n - min(s.count('0'), s.count('1')) * 2)


#####--------------Template Begin-------------------####
import math
import sys
import string
#input = sys.stdin.readline
def ri(): #Regular input
	return input()
def ii(): #integer input
	return int(input())
def li(): #list input
	return input().split()
def mi(): #map input
	return list(map(int, input().split()))
#####---------------Template Ends-------------------######
n=ii()
s=ri()
z=0
o=0
for i in s:
	if i=="0":
		z+=1
	else:
		o+=1
print(abs(z-o))


#####--------------Template Begin-------------------####
import math
import sys
import string
#input = sys.stdin.readline
def ri(): #Regular input
	return input()
def ii(): #integer input
	return int(input())
def li(): #list input
	return input().split()
def mi(): #map input
	return list(map(int, input().split()))
#####---------------Template Ends-------------------######
n=ii()
s=ri()
length=n
while True:
	if s.replace("01", "") != s:
		s=s.replace("01", "")
		length-=2
	if s.replace("10", "")!=s:
		s=s.replace("10", "")
		length-=2
	if s.replace("10", "")==s and s.replace("01", "")==s:
		print(len(s))
		exit()


n = int(input())
a = input()
counter = 0
lst = []
for i in a:
  lst.append(i)
i = 0
if n == 1:
  print('1')
  exit()
while(i < n):
  if lst[i] == '1' and lst[i+1] == '0':
    lst.pop(i)
    lst.pop(i)
    n -= 2
    i -= 1
  elif lst[i] == '0' and lst[i+1] == '1':
    lst.pop(i)
    lst.pop(i)
    n -= 2
    i -= 1
  else:
    i+=1
  if i < 0:
    i = 0
  if(n == 0 or n - i == 1):
    break
print(len(lst))


n = int(input())
a = input()
q = a.count('1')-a.count('0')
if q < 0:
  q *= -1
print(q)


n = input()
a = input()
a = a.split('01')
b = ''.join(a)
b = b.split('10')
print(len(b))


n = int(input())
a = input()
if a.count('0') == n:
  print(n)
  exit()
if a.count('1') == n:
  print(n)
  exit()
while(True):
  temp = a
  a = a.split('01')
  a = ''.join(a)
  if len(temp) == len(a):
    break
while(True):
  temp = a
  a = a.split('10')
  a = ''.join(a)
  if len(temp) == len(a):
    break
print(len(a))


n = input()
a = input()
while(True):
  temp = a
  a = a.split('01')
  a = ''.join(a)
  if len(temp) == len(a):
    break
while(True):
  temp = a
  a = a.split('10')
  a = ''.join(a)
  if len(temp) == len(a):
    break
print(len(a))


n = int(input())
a = input()
counter = 0
lst = []
for i in a:
  lst.append(i)
i = 0
while(i < n):
  if lst[i] == '1' and lst[i+1] == '0':
    lst.pop(i)
    lst.pop(i)
    n -= 2
    i -= 1
  elif lst[i] == '0' and lst[i+1] == '1':
    lst.pop(i)
    lst.pop(i)
    n -= 2
    i -= 1
  else:
    i+=1
  if i < 0:
    i = 0
  if(n == 0 or n - i == 1):
    break
print(len(lst))


n=int(input())
a=input()
c=0
for i in a:
    if i=='0':
        c+=1
    else:
        c-=1
print(abs(c))


a=input()
c=0
for i in a:
    if i=='0':
        c+=1
    else:
        c-=1
print(abs(c))


n = int(input())
s = input()
while True:
    s = ''.join(s.split('10'))
    l = len(s)
    if l==n:
        break
    n=l

while True:
    s = ''.join(s.split('01'))
    l = len(s)
    if l==n:
        break
    n=l
print(len(s))


n = int(input())
s = input()
a = s.count('1')
b = s.count('0')
print(n-min(a,b)*2)


a = input()
c = []
b = []
for i in a:
    if i == "0":
        c.append(1)
    else:
        b.append(1)
j = c.count(1)
k = b.count(1)
if j==k:
    print("0")
elif j<k:
    j = k-j
    print(j)
else:
    k = j-k
    print(k)


u = int(input())
a = input()
c = []
b = []
for i in a:
    if i == "0":
        c.append(1)
    else:
        b.append(1)
j = c.count(1)
k = b.count(1)
if j==k:
    print("0")
elif j<k:
    j = k-j
    print(j)
else:
    k = j-k
    print(k)


n=int(input())
s=input()
if int(s)==0:
	print(n)
	exit()
else:
	while True:
		if '10' in s:
			p=s.index('10')
			s=s[:p]+s[p+2:]
		elif '01' in s:
			p=s.index('01')
			s=s[:p]+s[p+2:]
		else:
			print(len(s))
			break


n=int(input())
s=input()
if int(s)==0:
	print(n)
	break
else:
	while True:
		if '10' in s:
			p=s.index('10')
			s=s[:p]+s[p+2:]
		elif '01' in s:
			p=s.index('01')
			s=s[:p]+s[p+2:]
		else:
			print(len(s))
			break


n=int(input())
s=input()
while True:
	if '10' in s:
		p=s.index('10')
		s=s[:p]+s[p+2:]
	elif '01' in s:
		p=s.index('01')
		s=s[:p]+s[p+2:]
	else:
		print(len(s))
		break


n=input()
s=input()

c1=0
c0=0
for i in range(len(s)):
    if(s[i]=='0'):
        c0+=1
    else:

        c1+=1
cmin=min(c1,c0)
sol=len(s)-2*cmin
if(sol<0):
    print(0)
else:
    print(sol)


s=input()

c1=0
c0=0
for i in range(len(s)):
    if(s[i]=='0'):
        c0+=1
    else:

        c1+=1
cmin=min(c1,c0)
sol=len(s)-2*cmin
if(sol<0):
    print(0)
else:
    print(sol)


n=int(input())
num=input()

one=num.count('1')
zero=num.count('0')

print(abs(one-zero))


n=int(input())
num=input()

l=len(num)
one=num.count('1')
zero=num.count('0')
while(True):
	if("01" in num):
		num=num.replace("01","")
	if("10" in num):
		num=num.replace("10","")
	l=len(num)
	one=num.count('1')
	zero=num.count('0')
	if((l!=one) or (l!=zero)):
		break

print(len(num))


n=int(input())
num=input()

l=len(num)
one=num.count('1')
zero=num.count('0')
while(True):
	if("01" in num):
		num=num.replace("01","")
	if("10" in num):
		num=num.replace("10","")
	l=len(num)
	one=num.count('1')
	zero=num.count('0')
	if((l==one) or (l==zero)):
		break

print(len(num))


n = int(input())
s = input()
x = s.count("0")
y = s.count("1")
print(abs(x-y))


n = int(input())
s = input()
while '10' in s or '01' in s:
    if '01' in s:
        s = s.replace('01', '')
    elif '10' in s:
        s = s.replace('10', '')

print(len(s))


n = int(input())
s = input()
one = s.count('1')

print(abs(n - 2 * one))


n = int(input())
s = input()
o = s.count("0")
z = s.count("1")
print(abs(z-o))


n = int(input())
s = input()
while(s != None and (s.find("10")!= -1 or s.find("01") != -1)):
    s= s.replace("10","")
    s= s.replace("01","")
print(len(s))


n=input()
mot=input()
rang=0
L=''
for i in mot:
    if rang==0 or L[-1]==i:
        L+=i
        rang+=1
    else:
        L=L[:-1]
        rang-=1
print (len(L))


n=input()
mot=input()
rang=0
L=''
for i in mot:
    if rang==0 or L[-1]==i:
        L+=i
        rang+=1
    else:
        del L[-1]
        rang-=1
print (len(L))


n=input()
mot=input()
rang=0
L=''
for i in mot:
    if i=='1':
        rang+=1
    else:
        rang-=1

print(abs(rang))


siz=int(input())
string = input()

i=0
while siz-1>i:
    string=string.replace("10", "")
    string=string.replace("01", "")
    i=i+1
print(len(string))


siz=int(input())
string = input()

i=0
while siz-1>i:
    string=string.replace("10", "")
    i=i+1
print(len(string))


n=int(input())
s1=input()
z=0
o=0
for i in s1:
    if i=='0':
        z=z+1
    else:
        o=o+1
print(abs(o-z))


import collections
import itertools
import sys
from collections import defaultdict, Counter
from math import sqrt

input = sys.stdin.readline

############ ---- Input Functions ---- ############
def inp():
    return (int(input()))

def inlt():
    return (list(map(int, input().split())))

def insr():
    s = input()
    return (list(s[:len(s) - 1]))

def invr():
    return (map(int, input().split()))

def s(d):
    dis = 1 + 4 * 2 * 3 * d
    ds = sqrt(dis)
    return (-1 + ds) / 6

def main():
    d = inp()
    r = insr()
    s = collections.deque()
    s.append(r[0])
    l = r[0]
    for v in r[1:]:
        if l != v:
            s.pop()
            l = s[-1]
            continue
        else:
            s.append(v)
    print(len(s))

if __name__ == "__main__":
    # sys.setrecursionlimit(10 ** 6)
    # threading.stack_size(10 ** 8)
    # t = threading.Thread(target=main)
    # t.start()
    # t.join()
    main()


import collections
import itertools
import sys
from collections import defaultdict, Counter
from math import sqrt

input = sys.stdin.readline

############ ---- Input Functions ---- ############
def inp():
    return (int(input()))

def inlt():
    return (list(map(int, input().split())))

def insr():
    s = input()
    return (list(s[:len(s) - 1]))

def invr():
    return (map(int, input().split()))

def s(d):
    dis = 1 + 4 * 2 * 3 * d
    ds = sqrt(dis)
    return (-1 + ds) / 6

def main():
    d = inp()
    r = insr()
    s = list(r)
    i = 0
    for v in r:
        if i>0 and s[i-1] != v:
            i-=1
            continue
        else:
            s[i]=v
            i+=1
    print(i)

if __name__ == "__main__":
    # sys.setrecursionlimit(10 ** 6)
    # threading.stack_size(10 ** 8)
    # t = threading.Thread(target=main)
    # t.start()
    # t.join()
    main()


import itertools
import sys
from collections import defaultdict, Counter
from math import sqrt

input = sys.stdin.readline

############ ---- Input Functions ---- ############
def inp():
    return (int(input()))

def inlt():
    return (list(map(int, input().split())))

def insr():
    s = input()
    return (list(s[:len(s) - 1]))

def invr():
    return (map(int, input().split()))

def s(d):
    dis = 1 + 4 * 2 * 3 * d
    ds = sqrt(dis)
    return (-1 + ds) / 6

def main():
    d = inp()
    r = input().strip()
    d = r.replace('01', '').replace('10','')
    while d!=r:
        r = d
        d = d.replace('01', '').replace('10', '')
    print(len(d))

if __name__ == "__main__":
    # sys.setrecursionlimit(10 ** 6)
    # threading.stack_size(10 ** 8)
    # t = threading.Thread(target=main)
    # t.start()
    # t.join()
    main()


import itertools
import sys
from collections import defaultdict, Counter
from math import sqrt

input = sys.stdin.readline

############ ---- Input Functions ---- ############
def inp():
    return (int(input()))

def inlt():
    return (list(map(int, input().split())))

def insr():
    s = input()
    return (list(s[:len(s) - 1]))

def invr():
    return (map(int, input().split()))

def s(d):
    dis = 1 + 4 * 2 * 3 * d
    ds = sqrt(dis)
    return (-1 + ds) / 6

def main():
    d = inp()
    r = insr()
    s = r[0]
    l = r[0]
    for v in r:
        if l != v:
            s = s[:-2]
            continue
        else:
            s+=v
    print(len(s))

if __name__ == "__main__":
    # sys.setrecursionlimit(10 ** 6)
    # threading.stack_size(10 ** 8)
    # t = threading.Thread(target=main)
    # t.start()
    # t.join()
    main()


import itertools
import sys
from collections import defaultdict, Counter
from math import sqrt

input = sys.stdin.readline

############ ---- Input Functions ---- ############
def inp():
    return (int(input()))

def inlt():
    return (list(map(int, input().split())))

def insr():
    s = input()
    return (list(s[:len(s) - 1]))

def invr():
    return (map(int, input().split()))

def s(d):
    dis = 1 + 4 * 2 * 3 * d
    ds = sqrt(dis)
    return (-1 + ds) / 6

def main():
    d = inp()
    r = insr()
    s = r[0]
    l = r[0]
    for v in r[1:]:
        if l != v:
            s = s[:-2]
            continue
        else:
            s+=v
    print(len(s))

if __name__ == "__main__":
    # sys.setrecursionlimit(10 ** 6)
    # threading.stack_size(10 ** 8)
    # t = threading.Thread(target=main)
    # t.start()
    # t.join()
    main()


import collections
import itertools
import sys
from collections import defaultdict, Counter
from math import sqrt

input = sys.stdin.readline

############ ---- Input Functions ---- ############
def inp():
    return (int(input()))

def inlt():
    return (list(map(int, input().split())))

def insr():
    s = input()
    return (list(s[:len(s) - 1]))

def invr():
    return (map(int, input().split()))

def ds(s):
    r = []
    i = 0
    while i<len(s):
        if i==len(s)-1:
            r.append(s[i])
            i+=1
        else:
            if s[i]!=s[i+1]:
                i+=2
                continue
            else:
                r.append(s[i])
                i+=1
    return r

def main():
    d = inp()
    r = insr()
    d = ds(r)
    while d!=r:
        r = d
        d = ds(d)
    print(len(d))

if __name__ == "__main__":
    # sys.setrecursionlimit(10 ** 6)
    # threading.stack_size(10 ** 8)
    # t = threading.Thread(target=main)
    # t.start()
    # t.join()
    main()


import collections
import itertools
import sys
from collections import defaultdict, Counter
from math import sqrt

input = sys.stdin.readline

############ ---- Input Functions ---- ############
def inp():
    return (int(input()))

def inlt():
    return (list(map(int, input().split())))

def insr():
    s = input()
    return (list(s[:len(s) - 1]))

def invr():
    return (map(int, input().split()))

def s(d):
    dis = 1 + 4 * 2 * 3 * d
    ds = sqrt(dis)
    return (-1 + ds) / 6

def main():
    d = inp()
    r = insr()
    s = list(r)
    i = 1
    l = s[0]
    for v in r[1:]:
        if l != v:
            i-=1
            l = s[i]
            continue
        else:
            s[i]=v
            i+=1
    print(i)

if __name__ == "__main__":
    # sys.setrecursionlimit(10 ** 6)
    # threading.stack_size(10 ** 8)
    # t = threading.Thread(target=main)
    # t.start()
    # t.join()
    main()


import collections
import itertools
import sys
from collections import defaultdict, Counter
from math import sqrt

input = sys.stdin.readline

############ ---- Input Functions ---- ############
def inp():
    return (int(input()))

def inlt():
    return (list(map(int, input().split())))

def insr():
    s = input()
    return (list(s[:len(s) - 1]))

def invr():
    return (map(int, input().split()))

def s(d):
    dis = 1 + 4 * 2 * 3 * d
    ds = sqrt(dis)
    return (-1 + ds) / 6

def main():
    d = inp()
    r = insr()
    s = list(r)
    i = 1
    l = s[i]
    for v in r[1:]:
        if l != v:
            i-=1
            l = s[i]
            continue
        else:
            s[i]=v
            i+=1
    print(i)

if __name__ == "__main__":
    # sys.setrecursionlimit(10 ** 6)
    # threading.stack_size(10 ** 8)
    # t = threading.Thread(target=main)
    # t.start()
    # t.join()
    main()


import collections
import itertools
import sys
from collections import defaultdict, Counter
from math import sqrt

input = sys.stdin.readline

############ ---- Input Functions ---- ############
def inp():
    return (int(input()))

def inlt():
    return (list(map(int, input().split())))

def insr():
    s = input()
    return (list(s[:len(s) - 1]))

def invr():
    return (map(int, input().split()))

def s(d):
    dis = 1 + 4 * 2 * 3 * d
    ds = sqrt(dis)
    return (-1 + ds) / 6

def main():
    d = inp()
    r = insr()
    s = collections.deque()
    s.append(r[0])
    l = r[0]
    for v in r[1:]:
        if l != v:
            s.pop()
            l = s[0] if s else None
            continue
        else:
            s.append(v)
            l = v
    print(len(s))

if __name__ == "__main__":
    # sys.setrecursionlimit(10 ** 6)
    # threading.stack_size(10 ** 8)
    # t = threading.Thread(target=main)
    # t.start()
    # t.join()
    main()


import itertools
import sys
from collections import defaultdict, Counter
from math import sqrt

input = sys.stdin.readline

############ ---- Input Functions ---- ############
def inp():
    return (int(input()))

def inlt():
    return (list(map(int, input().split())))

def insr():
    s = input()
    return (list(s[:len(s) - 1]))

def invr():
    return (map(int, input().split()))

def s(d):
    dis = 1 + 4 * 2 * 3 * d
    ds = sqrt(dis)
    return (-1 + ds) / 6

def main():
    d = inp()
    r = insr()
    s = r[0]
    l = r[0]
    for v in r[1:]:
        if l != v:
            s = s[:-1]
            continue
        else:
            s+=v
    print(len(s))

if __name__ == "__main__":
    # sys.setrecursionlimit(10 ** 6)
    # threading.stack_size(10 ** 8)
    # t = threading.Thread(target=main)
    # t.start()
    # t.join()
    main()


#!/usr/bin/env python
# -*- coding: utf-8 -*-

n = int(input())
s = input()
length = len(s)

i = 0
while i + 1 < length:
    if (s[i] + s[i+1]) in ['01', '10']:
        s = s[:i] + s[i+2:]
        length -= 2
        i -= 2
    i += 1
print(len(s))


#!/usr/bin/env python
# -*- coding: utf-8 -*-

n = int(input())
s = input()

z = s.count('1')
o = s.count('0')

print(n - min(z,o)*2)


n = int(input())
a = input()
while True:
    b = a
    a = a.replace('01', '')
    a = a.replace('10', '')
    if b == a:
        break
print(len(a))


n = int(input())
a = input()
while True:
    if '1' not in a:
        break
    b = a
    a = a.replace('01', '')
    a = a.replace('10', '')
    if b == a:
        break
print(len(a))


n = int(input())
a = input()
x, z = a.count('0'), a.count('1')
print(x + z - (min(x, z)*2))


# Дело о нулях и единицах https://codeforces.com/problemset/problem/556/A

_ = input()
s = input()

print(abs(s.count('0') - s.count('1')))


n = int(input())
s =  input()
while True:
    if "10" in s:
        s = s.replace("10","")
    elif "01" in s:
        s = s.replace("01","")
    else:
        break
print(s)


n = int(input())
a = input()
one = a.count("1")
zero = a.count("0")
print(abs(one-zero))


n = int(input())
s =  input()
while True:
    if "10" in s:
        s = s.replace("10","")
    elif "01" in s:
        s = s.replace("01","")
    else:
        break
print(len(s))


n = int(input())
s = input()
x = [s.count(str(i)) for i in range(2)]
print(max(x) - min(x))


# Lang: pypy3.6-v7.1.0-win32\pypy3.exe
# Problem Name: CaseOfTheZerosAndOnes
# Problem Serial No: 556
# Problem Type: A
# Problem Url: https://codeforces.com/problemset/problem/556/A
# Solution Generated at: 2019-05-11 21:54:53.453548 UTC

n=int(input())
string=input()

while True:
    if len(string)==0:
        print(0)
        break
    else:
        m=string.replace("10","")
        if len(m)==0: print(0);break
        else:
            k=m.replace("01","")
            if len(k)==0: print(0);break
            else:
                if string==k: print(len(k));break
                else: string=k

# Accepted


# Lang: pypy3.6-v7.1.0-win32\pypy3.exe
# Problem Name: CaseOfTheZerosAndOnes
# Problem Serial No: 556
# Problem Type: A
# Problem Url: https://codeforces.com/problemset/problem/556/A
# Solution Generated at: 2019-05-11 21:54:53.453548 UTC

n=int(input())
string=input()
if string.find("01")==-1 and string.find("10")==-1:
    print(len(string))
    exit()
else:
    while True:
        if len(string) == 0:
            print(0)
            break
        elif string.find("01")==-1 and string.find("10")==-1:
            print(len(string))
            break
        else:
            m = string.replace("10", "")
            if len(m) == 0:
                print(0);break
            else:
                k = m.replace("01", "")
                if len(k) == 0:
                    print(0);break
                else:
                    if string == k:
                        print(len(k));break
                    else:
                        string = k

# Accepted


# Lang: pypy3.6-v7.1.0-win32\pypy3.exe
# Problem Name: CaseOfTheZerosAndOnes
# Problem Serial No: 556
# Problem Type: A
# Problem Url: https://codeforces.com/problemset/problem/556/A
# Solution Generated at: 2019-05-11 21:54:53.453548 UTC

n=int(input())
string=input()

while True:
    if string.find('0')==-1 or string.find("1")==-1:
        print(len(string))
        exit()
    else:
        string=string.replace("10","")
        string=string.replace("01","")

# Accepted


# Lang: pypy3.6-v7.1.0-win32\pypy3.exe
# Problem Name: CaseOfTheZerosAndOnes
# Problem Serial No: 556
# Problem Type: A
# Problem Url: https://codeforces.com/problemset/problem/556/A
# Solution Generated at: 2019-05-11 21:54:53.453548 UTC

n = int(input())
s = input()
print(abs(s.count('0') - s.count('1')))
# Accepted


n = int(input())
s = str(input())

while(not(s.count('10')==0 and s.count('01')==0)):
	s = s.replace('01','')
	s = s.replace('10','')
	if (len(s)==0 or len(s)==1):
		break
print(len(s))


n = int(input())
a = [int(i) for i in input()]

loop_it = True

while(loop_it==True):
	i = 0
	if(len(a)==1 or len(a)==0):
		break
	while(i<len(a)-1):
		if len(a)==1 or len(a)==0:
			loop_it = False
			break

		elif (a[i]==0 and a[i+1]==1) or (a[i]==1 and a[i+1]==0):
			a.remove(a[i])
			a.remove(a[i])
			i = 0

		else:
			loop_it = False
		i+=1
	if (len(a)==2):
		if (a[0]==0 and a[1]==1) or (a[0]==1 and a[1]==0):
			a.remove(a[0])
			a.remove(a[0])

print(len(a))


n = int(input())
s = str(input())
print(n-2*(min(s.count('0'),s.count('1'))))


n = int(input())
a = [int(i) for i in input()]

loop_it = True

while(loop_it==True):
	i = 0
	if(len(a)==1 or len(a)==0):
		break
	while(i<len(a)-1):
		if len(a)==1 or len(a)==0:
			loop_it = False
			break

		elif (a[i]==0 and a[i+1]==1) or (a[i]==1 and a[i+1]==0):
			a.remove(a[i])
			a.remove(a[i])
			loop_it = True

		else:
			loop_it = False
		i+=1

print(len(a))


n=int(input())
a=list(input())
s=0
f=0
for i in range(n-1):
    if( a[i+1]=='0' and a[i]=='1' and f==0):
        s-=2
        f=1
    else:
        s+=1
print(s)


n=int(input())
a=list(input())
s=0
f=0
for i in range(n):
    if(a[i]=='1'):
        s+=1
    else:
        f+=1
print(abs(s-f))


x = int(input())
s = input()
print(abs(s.count('1') - s.count('0')))


x = int(input())
s = input()
z = s
while("10" in s or "01" in s):
    s = s.replace("10","")
    s = s.replace("01", "")
#print(s)
print(len(s))


n = int (input())
ch = list (input())

print (abs(ch.count("1") - ch.count("0")))


n = int (input())
ch = list (input())

while ( (len(ch)>0) and '1' in ch and '0' in ch ):
    del(ch[ch.index("1")])
    del(ch[ch.index("0")])
print (len(ch))


n = int(input())
s = list(input())
trial = True

while len(s) > 1 and trial:
    for i in range(len(s) - 1):
        if (s[i] == "0" and s[i+1] == "1") or (s[i] == "1" and s[i+1] == "0"):
            del s[i]
            del s[i]
            break
        if i == len(s) - 2:
            trial = False

print(len(s))


n = int(input())
s = list(input())
if "1" in s and "0" in s:
    trial = True
else:
    trial = False

while len(s) > 1 and trial:
    for i in range(len(s) - 1):
        if (s[i] == "0" and s[i+1] == "1") or (s[i] == "1" and s[i+1] == "0"):
            del s[i]
            del s[i]
            break
        if i == len(s) - 2:
            trial = False

print(len(s))


n = int(input())
s = list(input())

zeros = s.count('0')
ones = n - zeros

minimum = min(zeros, ones)

print(n-2*minimum)


l, s = input(), input().strip()
print(abs(s.count('1')-l))


l, s = int(input().strip()), input().strip()
print(abs(s.count('1')-l))


import random
import timeit
_, s = input(), input().strip()
pattern_1, pattern_2 = '10', '01'

def randomString(stringLength=200000):
    """Generate a random string of fixed length """
    letters = ['0','1']
    return ''.join(random.choice(letters) for i in range(stringLength))

code_to_test = """
l = []
for i in range(1,21):
  l.append(randomString())

for word in l:
  while pattern_1 in word or pattern_2 in word:
  #if pattern_1 in s:
      l = word.split(pattern_1)
      word = ''.join(l)
      l = word.split(pattern_2)
      word = ''.join(l)
  print("Fine di una word")
  #else:
  #  l = s.split(pattern_2)
  #  s = ''.join(l)

#print(len(s))
"""

elapsed_time = timeit.timeit(code_to_test, number=100)/100
print(elapsed_time)


_, s = input(), input().strip()
pattern_1, pattern_2 = '10', '01'
#ciao
while pattern_1 in s or pattern_2 in s:
  l = s.split(pattern_1)
  s = ''.join(l)
  l = s.split(pattern_2)
  s = ''.join(l)

print(len(s))


_, s = input(), input().strip()
pattern_1, pattern_2 = '10', '01'

if s.count("0") == s.count("1"):
  print(0)
else:
  while pattern_1 in s or pattern_2 in s:
    l = s.split(pattern_1)
    s = ''.join(l)
    l = s.split(pattern_2)
    s = ''.join(l)
  print(len(s))


_, s = input(), input().strip()
pattern_1, pattern_2 = '10', '01'

while pattern_1 in s or pattern_2 in s:
  l = s.split(pattern_1)
  s = ''.join(l)
  l = s.split(pattern_2)
  s = ''.join(l)

print(len(s))


l, s = int(input().strip()), input().strip()
print(abs(s.count('1')*2-l))


n=int(input())
s=input()
f=1
while f==1:
    f=0
    x=len(s)
    s=s.replace('01','')
    s=s.replace('10','')
    if len(s)!=x:
        f=1
print(len(s))


n=int(input())
s=input()
x=s.count('1')
y=s.count('0')
print(abs(x-y))


n=int(input())
s=input()
while "10" in s or "01" in s:
    s=s.replace("10","")
    s=s.replace("01","")
print(len(s))


if __name__ == '__main__':
    n = int(input().strip())
    s = input().strip()
    print(abs(s.count('1') - s.count('0')))

# if __name__ == '__main__':
#     n = int(input().strip())
#     s = input().strip()
#     st = []
#     for i in range(len(s)):
#         if s[i] == '0':
#             if len(st) > 0 and st[-1] == '1':
#                 st.pop()
#             else:
#                 st.append('0')
#         else:
#             if len(st) > 0 and st[-1] == '0':
#                 st.pop()
#             else:
#                 st.append('1')
#     print(len(st))


if __name__ == '__main__':
    n = int(input().strip())
    s = input().strip()
    st = []
    for i in range(n):
        if s[i] == '0':
            if len(st) > 0 and st[-1] == '1':
                st.pop()
            else:
                st.append('0')
        else:
            st.append('1')
    print(len(st))


/*
これを入れて実行
g++ code.cpp
./a.out
 */

#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>
#include <cassert>
#include <random>

#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

using namespace std;
typedef long long ll;
typedef long double ld;

int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};

const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}

ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}

ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll conbinationMemo[100][100];

void cmemoInit(){
    rep(i, 100){
        rep(j, 100){
            conbinationMemo[i][j] = -1;
        }
    }
}

ll nCr(ll n, ll r){
    if(conbinationMemo[n][r] != -1) return conbinationMemo[n][r];
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return conbinationMemo[n][r] = (nCr(n - 1, r) + nCr(n - 1, r - 1));
}

ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
//-----------------------ここから-----------
int main(void){
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n);
    vector<ll> sz(n);
    vector<map<ll,ll>> mp2(11);
    rep(i, n){
        cin >> a[i];
        string s = to_string(a[i]);
        sz[i] = s.size();

    }

    vector<map<ll,ll>> mp(11, map<ll,ll>());

    rep(i, n){

    }
    ll ans = 0;
    rep(i, n){
        ll now = 1;
        ans += mp[sz[i]][(k-(a[i]%k))%k];
        ll tot = 0;
        for(ll j = 0; j < 11; j++){
            ll tmp = (a[i]%k) * ((ll)pow(10LL, j) % k) % k;
            tot += mp2[j][(k-tmp)%k];
            mp[j][(a[i]%k)*(now%k)%k]++;
            now *= 10;
        }
        ans += tot;
        //cout << mp[sz[i]][(k-(a[i]%k))%k] << " " << tot << endl;
        mp2[sz[i]][a[i]%k]++;
    }
    cout << ans << endl;
}


/*
これを入れて実行
g++ code.cpp
./a.out
 */

#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>
#include <cassert>
#include <random>

#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

using namespace std;
typedef long long ll;
typedef long double ld;

int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};

const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}

ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}

ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll conbinationMemo[100][100];

void cmemoInit(){
    rep(i, 100){
        rep(j, 100){
            conbinationMemo[i][j] = -1;
        }
    }
}

ll nCr(ll n, ll r){
    if(conbinationMemo[n][r] != -1) return conbinationMemo[n][r];
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return conbinationMemo[n][r] = (nCr(n - 1, r) + nCr(n - 1, r - 1));
}

ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
//-----------------------ここから-----------
int main(void){
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n);
    vector<ll> sz(n);
    rep(i, n){
        cin >> a[i];
        string s = to_string(a[i]);
        sz[i] = s.size();
    }

    vector<map<ll,ll>> mp(11, map<ll,ll>());
    vector<vector<ll>> mp2(n, vector<ll>(11));
    rep(i, n){

    }
    ll ans = 0;
    rep(i, n){
        ll now = 1;
        rep(j, 11){
            mp[j][(a[i]%k)*(now%k)%k]++;
            mp2[i][j] = ((a[i]%k)*(now%k))%k;
            now *= 10;
        }
        ans += mp[sz[i]][(k-(a[i]%k))%k];
        if(mp2[i][sz[i]] == (k-(a[i]%k))%k){
            ans--;
        }

        ans += mp[0][mp2[i][sz[i]]];
        if(mp2[i][0] == mp2[i][sz[i]]){
            ans--;
        }
    }
    cout << ans << endl;
}


/*
これを入れて実行
g++ code.cpp
./a.out
 */

#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>
#include <cassert>
#include <random>

#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

using namespace std;
typedef long long ll;
typedef long double ld;

int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};

const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}

ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}

ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll conbinationMemo[100][100];

void cmemoInit(){
    rep(i, 100){
        rep(j, 100){
            conbinationMemo[i][j] = -1;
        }
    }
}

ll nCr(ll n, ll r){
    if(conbinationMemo[n][r] != -1) return conbinationMemo[n][r];
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return conbinationMemo[n][r] = (nCr(n - 1, r) + nCr(n - 1, r - 1));
}

ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
//-----------------------ここから-----------
int main(void){
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n);
    vector<ll> sz(n);
    vector<ll> pw(11);
    vector<unordered_map<ll,ll>> mp(11);
    rep(i, n){
        cin >> a[i];
        string s = to_string(a[i]);
        sz[i] = s.size();
        mp[sz[i]][a[i] % k]++;
    }

    rep(i, 11){
        pw[i] = pow(10LL, i);
    }
    ll ans = 0;
    rep(i, n){
        for(ll j = 1; j < 11; j++){
            ll rem = ((a[i] % k) * (pw[j] % k)) % k;
            ans += mp[j][(k-rem)%k];
            if(sz[i]==j && (rem + a[i] % k) % k == 0){
                ans--;
            }
        }
    }

    cout << ans << endl;
}


/*
これを入れて実行
g++ code.cpp
./a.out
 */

#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>
#include <cassert>
#include <random>

#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

using namespace std;
typedef long long ll;
typedef long double ld;

int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};

const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}

ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}

ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll conbinationMemo[100][100];

void cmemoInit(){
    rep(i, 100){
        rep(j, 100){
            conbinationMemo[i][j] = -1;
        }
    }
}

ll nCr(ll n, ll r){
    if(conbinationMemo[n][r] != -1) return conbinationMemo[n][r];
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return conbinationMemo[n][r] = (nCr(n - 1, r) + nCr(n - 1, r - 1));
}

ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
//-----------------------ここから-----------
int main(void){
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n);
    vector<ll> sz(n);
    vector<ll> pw(11);
    vector<unordered_map<ll,ll>> mp2(11);
    rep(i, n){
        cin >> a[i];
        string s = to_string(a[i]);
        sz[i] = s.size();

    }

    rep(i, 11){
        pw[i] = pow(10LL, i);
    }

    vector<unordered_map<ll,ll>> mp(11, unordered_map<ll,ll>());

    rep(i, n){

    }
    ll ans = 0;
    rep(i, n){
        ll now = 1;
        ans += mp[sz[i]][(k-(a[i]%k))%k];
        ll tot = 0;
        for(ll j = 0; j < 11; j++){
            ll tmp = (a[i]%k) * (pw[j] % k) % k;
            tot += mp2[j][(k-tmp)%k];
            mp[j][(a[i]%k)*(now%k)%k]++;
            now *= 10;
        }
        ans += tot;
        //cout << mp[sz[i]][(k-(a[i]%k))%k] << " " << tot << endl;
        mp2[sz[i]][a[i]%k]++;
    }
    cout << ans << endl;
}


/*
これを入れて実行
g++ code.cpp
./a.out
 */

#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>
#include <cassert>
#include <random>

#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

using namespace std;
typedef long long ll;
typedef long double ld;

int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};

const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}

ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}

ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll conbinationMemo[100][100];

void cmemoInit(){
    rep(i, 100){
        rep(j, 100){
            conbinationMemo[i][j] = -1;
        }
    }
}

ll nCr(ll n, ll r){
    if(conbinationMemo[n][r] != -1) return conbinationMemo[n][r];
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return conbinationMemo[n][r] = (nCr(n - 1, r) + nCr(n - 1, r - 1));
}

ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
//-----------------------ここから-----------
int main(void){
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n);
    vector<ll> sz(n);
    vector<ll> pw(11);
    vector<map<ll,ll>> mp(11);
    rep(i, n){
        cin >> a[i];
        string s = to_string(a[i]);
        sz[i] = s.size();
        mp[sz[i]][a[i] % k]++;
    }

    rep(i, 11){
        pw[i] = pow(10LL, i);
    }
    ll ans = 0;
    rep(i, n){
        for(ll j = 1; j < 11; j++){
            ll rem = ((a[i] % k) * (pw[j] % k)) % k;
            ans += mp[j][(k-rem)%k];
            if(sz[i]==j && (rem + a[i] % k) % k == 0){
                ans--;
            }
        }
    }

    cout << ans << endl;

}


/*
これを入れて実行
g++ code.cpp
./a.out
 */

#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>
#include <cassert>
#include <random>

#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

using namespace std;
typedef long long ll;
typedef long double ld;

int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};

const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}

ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}

ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll conbinationMemo[100][100];

void cmemoInit(){
    rep(i, 100){
        rep(j, 100){
            conbinationMemo[i][j] = -1;
        }
    }
}

ll nCr(ll n, ll r){
    if(conbinationMemo[n][r] != -1) return conbinationMemo[n][r];
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return conbinationMemo[n][r] = (nCr(n - 1, r) + nCr(n - 1, r - 1));
}

ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
//-----------------------ここから-----------
int main(void){
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];

    vector<map<ll,ll>> mp(11, map<ll,ll>());
    vector<vector<ll>> mp2(n, vector<ll>(11));
    rep(i, n){
        ll now = 1;
        rep(j, 11){
            mp[j][a[i]*now%k]++;
            mp2[i][j] = a[i]*now%k;
            now *= 10;
        }
    }
    ll ans = 0;
    rep(i, n){
        string s = to_string(a[i]);
        ans += mp[(ll)s.size()][(k-a[i]%k)%k];
        if(mp2[i][(ll)s.size()] == (k-a[i]%k)%k){
            ans--;
        }
    }
    cout << ans << endl;
}


/*
これを入れて実行
g++ code.cpp
./a.out
 */

#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>
#include <cassert>
#include <random>

#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

using namespace std;
typedef long long ll;
typedef long double ld;

int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};

const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}

ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}

ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll conbinationMemo[100][100];

void cmemoInit(){
    rep(i, 100){
        rep(j, 100){
            conbinationMemo[i][j] = -1;
        }
    }
}

ll nCr(ll n, ll r){
    if(conbinationMemo[n][r] != -1) return conbinationMemo[n][r];
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return conbinationMemo[n][r] = (nCr(n - 1, r) + nCr(n - 1, r - 1));
}

ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
//-----------------------ここから-----------
int main(void){
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n);
    vector<ll> sz(n);
    vector<unordered_map<ll,ll>> mp2(11);
    rep(i, n){
        cin >> a[i];
        string s = to_string(a[i]);
        sz[i] = s.size();

    }

    vector<unordered_map<ll,ll>> mp(11, unordered_map<ll,ll>());

    rep(i, n){

    }
    ll ans = 0;
    rep(i, n){
        ll now = 1;
        ans += mp[sz[i]][(k-(a[i]%k))%k];
        ll tot = 0;
        for(ll j = 0; j < 11; j++){
            ll tmp = (a[i]%k) * ((ll)pow(10LL, j) % k) % k;
            tot += mp2[j][(k-tmp)%k];
            mp[j][(a[i]%k)*(now%k)%k]++;
            now *= 10;
        }
        ans += tot;
        //cout << mp[sz[i]][(k-(a[i]%k))%k] << " " << tot << endl;
        mp2[sz[i]][a[i]%k]++;
    }
    cout << ans << endl;
}


/*
これを入れて実行
g++ code.cpp
./a.out
 */

#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>
#include <cassert>
#include <random>

#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

using namespace std;
typedef long long ll;
typedef long double ld;

int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};

const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}

ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}

ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll conbinationMemo[100][100];

void cmemoInit(){
    rep(i, 100){
        rep(j, 100){
            conbinationMemo[i][j] = -1;
        }
    }
}

ll nCr(ll n, ll r){
    if(conbinationMemo[n][r] != -1) return conbinationMemo[n][r];
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return conbinationMemo[n][r] = (nCr(n - 1, r) + nCr(n - 1, r - 1));
}

ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
//-----------------------ここから-----------
int main(void){
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n);
    vector<ll> sz(n);
    vector<ll> pw(11);
    vector<vector<ll>> rems(11);
    rep(i, n){
        cin >> a[i];
        string s = to_string(a[i]);
        sz[i] = s.size();
        rems[sz[i]].push_back(a[i] % k);
    }

    rep(i, 11){
        pw[i] = pow(10LL, i);
        sort(all(rems[i]));
    }
    ll ans = 0;
    rep(i, n){
        for(ll j = 1; j < 11; j++){
            ll rem = ((a[i] % k) * (pw[j] % k)) % k;
            ll xrem = (k - rem) % k;
            auto l = lower_bound(all(rems[j]), xrem);
            auto r = upper_bound(all(rems[j]), xrem);
            ans += (r - l);
            if(sz[i]==j && (rem + a[i] % k) % k == 0){
                ans--;
            }
        }
    }

    cout << ans << endl;

}


#include<bits/stdc++.h>
using namespace std;
#define l first
#define r second
#define ed '\n'
#define INF 0x3f3f3f3f
#define cl(x, v) for(auto &w : x) w = v
#define all(x) begin(x), end(x)
#define sz(x) ((int)(x).size())
#define OUTIO ios_base::sync_with_stdio(0); cin.tie(0)
#define TIME cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"
#ifdef AC
	#define FILEIO \
		freopen("r.in", "r", stdin); \
		freopen("w.out", "w", stdout)
#else
	#define FILEIO
#endif
#define debug(...) do{\
	cerr << __PRETTY_FUNCTION__ << " - " << __LINE__ << ": (" << #__VA_ARGS__ << ") = ";\
	_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I && x){
	cerr << x << endl;
}
template<typename I,typename...T> void _DO(I && x, T && ...tail){
	cerr << x << ", ";
	_DO(tail...);
}
template<typename A, typename B>
ostream& operator <<(ostream &s, const pair<A, B> &p) {
	return s << "(" << p.first << "," << p.second << ")";
}
template<typename T>
ostream& operator <<(ostream &s, const vector<T> &c) {
	s << "[ "; for (auto it : c) s << it << " "; s << "]";
	return s;
}
typedef long long ll;
typedef unsigned long long ULL;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
const int maxn = 200000 + 5;
const int maxd = 11;
ll a[maxn], d[maxn][maxd];
vector<map<ll, ll> > v;
int turn(int x){
	int c = 0;
	while(x){
		c++;
		x /= 10;
	}
	return c;
}
int main(){
	OUTIO; FILEIO;
	int N, K; cin >> N >> K;
	v.resize(maxd);
	for(int i = 0; i < N; i++){
		cin >> a[i];
		for(ll k = 1, j = 0; j < maxd; k *= 10, j++){
			ll q = ((a[i] * k) % K);
			d[i][j] = q;
			v[j][q] = v[j][q] + 1;
		}
	}
	/*
	for(int i = 0; i < maxd; i++){
		for(auto it = v[i].begin(); it != v[i].end(); it++)
			cout << it -> l << ' ' << it -> r << ed;
		cout << ed;
	}
	*/
	ll ans = 0;
	for(int i = 0; i < N; i++){
		ll p = d[i][0];
		ll t = turn(a[i]);
		auto it =  v[t].find((K - p) % K);
		if(it != v[t].end()){
			ans += it -> r;
			//cout <<  i << ' ' << it -> r << ed;
			if((d[i][t] + p) % K == 0) ans--;
		}
	}
	cout << ans << ed;
	TIME;
}


#include<bits/stdc++.h>
using namespace std;
#define l first
#define r second
#define int long long
#define ed '\n'
#define INF 0x3f3f3f3f
#define cl(x, v) for(auto &w : x) w = v
#define all(x) begin(x), end(x)
#define sz(x) ((int)(x).size())
#define OUTIO ios_base::sync_with_stdio(0); cin.tie(0)
#define TIME cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"
#ifdef AC
	#define FILEIO \
		freopen("r.in", "r", stdin); \
		freopen("w.out", "w", stdout)
#else
	#define FILEIO
#endif
#define debug(...) do{\
	cerr << __PRETTY_FUNCTION__ << " - " << __LINE__ << ": (" << #__VA_ARGS__ << ") = ";\
	_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I && x){
	cerr << x << endl;
}
template<typename I,typename...T> void _DO(I && x, T && ...tail){
	cerr << x << ", ";
	_DO(tail...);
}
template<typename A, typename B>
ostream& operator <<(ostream &s, const pair<A, B> &p) {
	return s << "(" << p.first << "," << p.second << ")";
}
template<typename T>
ostream& operator <<(ostream &s, const vector<T> &c) {
	s << "[ "; for (auto it : c) s << it << " "; s << "]";
	return s;
}
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
const int maxn = 200000 + 5;
const int maxd = 16;
int a[maxn], d[maxn][maxd];
vector<map<int, int> > v;
int turn(int x){
	int c = 0;
	while(x){
		c++;
		x /= 10;
	}
	return c;
}
main(){
	OUTIO; FILEIO;
	int N, K; cin >> N >> K;
	v.resize(maxn);
	for(int i = 0; i < N; i++){
		cin >> a[i];
		for(unsigned long long k = 1, j = 0; j < maxd; k *= 10, j++){
			int q = (int)((a[i] * k) % K);
			d[i][j] = q;
			v[j][q] = v[j][q] + 1;
		}
	}
	/*
	for(int i = 0; i < maxd; i++){
		for(auto it = v[i].begin(); it != v[i].end(); it++)
			cout << it -> l << ' ' << it -> r << ed;
		cout << ed;
	}
	*/
	int ans = 0;
	for(int i = 0; i < N; i++){
		int p = d[i][0];
		int t = turn(a[i]);
		auto it =  v[t].find((K - p) % K);
		if(it != v[t].end()){
			ans += it -> r;
			//cout <<  i << ' ' << it -> r << ed;
			if((d[i][t] + p) % K == 0){ ans--;}
		}
	}
	cout << ans << ed;
	TIME;
}


#include<bits/stdc++.h>
using namespace std;
#define l first
#define r second
#define ed '\n'
#define INF 0x3f3f3f3f
#define cl(x, v) for(auto &w : x) w = v
#define all(x) begin(x), end(x)
#define sz(x) ((int)(x).size())
#define OUTIO ios_base::sync_with_stdio(0); cin.tie(0)
#define TIME cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"
#ifdef AC
	#define FILEIO \
		freopen("r.in", "r", stdin); \
		freopen("w.out", "w", stdout)
#else
	#define FILEIO
#endif
#define debug(...) do{\
	cerr << __PRETTY_FUNCTION__ << " - " << __LINE__ << ": (" << #__VA_ARGS__ << ") = ";\
	_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I && x){
	cerr << x << endl;
}
template<typename I,typename...T> void _DO(I && x, T && ...tail){
	cerr << x << ", ";
	_DO(tail...);
}
template<typename A, typename B>
ostream& operator <<(ostream &s, const pair<A, B> &p) {
	return s << "(" << p.first << "," << p.second << ")";
}
template<typename T>
ostream& operator <<(ostream &s, const vector<T> &c) {
	s << "[ "; for (auto it : c) s << it << " "; s << "]";
	return s;
}
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
template <class T> struct is_iterator {
  template <class U, typename enable_if<!is_convertible<U, const char*>::value, int>::type = 0>
  constexpr static auto has_indirection(int) -> decltype(*declval<U>(), bool()) { return true; }
  template <class> constexpr static bool has_indirection(long) { return false; }
  constexpr static bool value = has_indirection<T>(0);
};

using uint = unsigned int;
// Buffer size should be 2^12 or 2^13 for optimal performance with files.
const uint BUFFER_SIZE = 1 << 12;
// Maximum possible length of a string representing primitive type
// assuming we won't encounter huge double values.
const uint MAX_LENGTH = 1 << 7;

namespace Detail {
  struct Width { uint value; };
  struct Fill { char value; };
  struct Base { uint value; };
  struct Precision { uint value; };
  struct Delimiter { const char* value; };
}  // namespace Detail

Detail::Width setWidth(uint value = 0) { return {value}; }
Detail::Fill setFill(char value = ' ') { return {value}; }
Detail::Base setBase(uint value = 10) { assert(2 <= value && value <= 36); return {value}; }
Detail::Precision setPrecision(uint value = 9) { assert(value < MAX_LENGTH); return {value}; }
Detail::Delimiter setDelimiter(const char* value = " ") { return {value}; }

/******************************* input classes ********************************/
class InputDevice {
protected:
  const char* head;
  const char* tail;

  InputDevice(const char* head, const char* tail) : head(head), tail(tail), base(setBase().value) {}

  virtual void fillInput() = 0;

  inline char nextChar() {
    if (__builtin_expect(head >= tail, false)) fillInput();
    return *head++;
  }

  template <class I> int readUnsignedIntGeneral(I& arg, char c) {
    I value = 0;
    int length = 0;
    for (;; ++length, c = nextChar()) {
      if (isDigit(c)) c -= '0';
      else if (isUpper(c)) c -= 'A' - 10;
      else if (isLower(c)) c -= 'a' - 10;
      else c = base;
      if (c >= base) break;
      value = base * value + c;
    }
    arg = value;
    return --head, length;
  }

  template <class I> inline int readUnsignedInt(I& arg, char c) {
    if (__builtin_expect(base > 10, false)) return readUnsignedIntGeneral(arg, c);
    I value = 0;
    int length = 0;
    for (; static_cast<unsigned char>(c - '0') < base; ++length, c = nextChar())
      value = base * value + c - '0';
    arg = value;
    return --head, length;
  }

  template <class I> inline bool readSignedInt(I& arg, char c) {
    bool negative = c == '-';
    if (negative) c = nextChar();
    typename make_unsigned<I>::type unsignedArg;
    if (readUnsignedInt(unsignedArg, c) == 0) return false;
    arg = negative ? ~static_cast<I>(unsignedArg - 1) : static_cast<I>(unsignedArg);
    return true;
  }

  template <class F> bool readFloatingPoint(F& arg, char c) {
    bool negative = c == '-';
    if (negative) c = nextChar();
    unsigned long long integerPart;
    if (readUnsignedInt(integerPart, c) == 0) return false;
    arg = static_cast<F>(integerPart);
    if (nextChar() == '.') {
      unsigned long long fractionalPart = 0;
      int fractionalLength = readUnsignedInt(fractionalPart, nextChar());
      if (fractionalLength > 0) {
        unsigned long long basePower = 1;
        for (; fractionalLength; --fractionalLength) basePower *= base;
        arg += static_cast<F>(fractionalPart) / basePower;
      }
    } else --head;
    if (negative) arg = -arg;
    return true;
  }

public:
  uint base;

  InputDevice(InputDevice const&) = delete;
  InputDevice& operator = (InputDevice const&) = delete;

  static inline bool isSpace(char c) { return static_cast<unsigned char>(c - '\t') < 5 || c == ' '; }
  static inline bool isDigit(char c) { return static_cast<unsigned char>(c - '0') < 10; }
  static inline bool isUpper(char c) { return static_cast<unsigned char>(c - 'A') < 26; }
  static inline bool isLower(char c) { return static_cast<unsigned char>(c - 'a') < 26; }
  static inline bool isOneOf(char c, const char* str) { return strchr(str, c) != nullptr; }

  void putBack() { --head; }  // can be called only once directly after successfully reading a character

  inline bool readChar(char& arg) {
    if (__builtin_expect(head >= tail, false)) {
      fillInput();
      if (__builtin_expect(head >= tail, false)) return arg = '\0', false;
    }
    return arg = *head++, true;
  }

  template <class UnaryPredicate>
  inline char skipCharacters(UnaryPredicate isSkipped) {
    char c;
    do { c = nextChar(); } while (isSkipped(c));
    return c;
  }
  inline char skipCharacters() { return skipCharacters(isSpace); }

  template <class UnaryPredicate>
  inline int readString(char* arg, int limit, UnaryPredicate isTerminator) {
    skipCharacters(isTerminator);
    // put back first non-skipped character, reserve space for null character
    int charsRead = 0;
    for (--head, --limit; head < tail; fillInput()) {
      ptrdiff_t chunkSize = find_if(head, min(tail, head + limit - charsRead), isTerminator) - head;
      arg = copy_n(head, chunkSize, arg);
      head += chunkSize;
      charsRead += chunkSize;
      if (chunkSize == 0 || head < tail) break;
    }
    return *arg = '\0', charsRead;
  }

  inline int readString(char* arg, int limit, const char* terminators) {
    if (!*terminators) return readString(arg, limit, InputDevice::isSpace);
    return readString(arg, limit, [terminators](char c) { return InputDevice::isOneOf(c, terminators); });
  }

  // property setters
  inline bool read(Detail::Base newBase) { base = newBase.value; return true; }
  // primitive types
  inline bool read() { return true; }
  inline bool read(char& arg) { return readChar(arg); }
  template <class I> inline typename enable_if<is_integral<I>::value && is_unsigned<I>::value,
  bool>::type read(I& arg) { return readUnsignedInt(arg, skipCharacters()) > 0; }
  template <class I> inline typename enable_if<is_integral<I>::value && is_signed<I>::value,
  bool>::type read(I& arg) { return readSignedInt(arg, skipCharacters()); }
  template <class F> inline typename enable_if<is_floating_point<F>::value,
  bool>::type read(F& arg) { return readFloatingPoint(arg, skipCharacters()); }
  // characters skip
  inline bool read(const char& arg) { skipCharacters([arg](char c) { return arg != c; }); return true; }
  inline bool read(const char* arg) {
    if (*arg) skipCharacters([arg](char c) { return InputDevice::isOneOf(c, arg); });
    else skipCharacters();
    return putBack(), true;
  }
  inline bool read(bool (*isSkipped)(char)) { skipCharacters(isSkipped); putBack(); return true; }
  // strings
  template <class I, class Terminator, class... Ts> inline typename enable_if<is_integral<I>::value,
  bool>::type read(char* arg, I limit, Terminator terminator, Ts&&... args) {
    readString(arg, static_cast<int>(limit), terminator);
    return read(forward<Ts>(args)...);
  }
  template <class I> inline typename enable_if<is_integral<I>::value,
  bool>::type read(char* arg, I limit) { return read(arg, limit, ""); }
  template <class... Ts>
  inline bool read(char* first, char* last, Ts&&... args) {
    return read(first, static_cast<int>(last - first), forward<Ts>(args)...);
  }
  template <int N, class... Ts>
  inline bool read(char (&arg)[N], Ts&&... args) { return read(static_cast<char*>(arg), N, forward<Ts>(args)...); }
  template <class Terminator, class... Ts>
  inline bool read(string& arg, Terminator terminator, Ts&&... args) {
    for (int length = 16, last = 0;; last += length, length <<= 1) {
      arg.resize(last + length);
      int charsRead = readString(&arg[last], length + 1, terminator);
      if (charsRead < length) {
        arg.resize(last + charsRead);
        return read(forward<Ts>(args)...);
      }
    }
  }
  inline bool read(string& arg) { return read(arg, ""); }
  // complex types and ranges
  template <class T1, class T2>
  inline bool read(pair<T1, T2>& arg) { return read(arg.first, arg.second); }
  template <class T>
  inline bool read(complex<T>& arg) {
    T real, imag;
    if (!read(real, imag)) return false;
    arg.real(real), arg.imag(imag);
    return true;
  }
  template <class T>
  inline bool read(vector<T>& arg) {
    uint n;
    if (!read(n)) return false;
    arg.resize(n);
    return read(arg.begin(), arg.end());
  }
  template <class Iterator, class... Ts> inline typename enable_if<is_iterator<Iterator>::value,
  bool>::type read(Iterator first, Iterator last, Ts&&... args) {
    for (; first != last; ++first) if (!read(*first)) return false;
    return read(forward<Ts>(args)...);
  }
  template <class Iterator, class I, class... Ts>
  inline typename enable_if<is_iterator<Iterator>::value && is_integral<I>::value,
  bool>::type read(Iterator first, I count, Ts&&... args) { return read(first, first + count, forward<Ts>(args)...); }
  // generic forwarding
  template <class T>
  inline auto read(T& arg) -> decltype(arg.read(*this)) { return arg.read(*this); }
  template <class T0, class T1, class... Ts>
  inline typename enable_if<!is_iterator<T0>::value && !is_convertible<T0, char*>::value,
  bool>::type read(T0&& arg0, T1&& arg1, Ts&&... args) {
    return read(forward<T0>(arg0)) && read(forward<T1>(arg1), forward<Ts>(args)...);
  }
};

class InputFile : public InputDevice {
  FILE* file;
  bool lineBuffered;
  bool owner;
  char buffer[BUFFER_SIZE];

  void fillInput() override {
    head = buffer;
    *buffer = '\0';
    if (__builtin_expect(!lineBuffered, true)) {
      tail = head + fread(buffer, 1, BUFFER_SIZE, file);
    } else {
      tail = head;
      if (fgets(buffer, BUFFER_SIZE, file)) while (*tail) ++tail;
    }
  }

public:
  InputFile(FILE* file = stdin, bool lineBuffered = true, bool takeOwnership = false)
  : InputDevice(buffer, buffer) , file(file), lineBuffered(lineBuffered), owner(takeOwnership) {}
  InputFile(const char* fileName) : InputFile(fopen(fileName, "r"), false, true) {}
  ~InputFile() { if (owner) fclose(file); }
};

// Picks up data appended to the string but doesn't handle reallocation.
class InputString : public InputDevice {
  void fillInput() override { while (*tail) ++tail; }

public:
  InputString(const string& s) : InputDevice(s.data(), s.data() + s.size()) {}
  InputString(const char* s) : InputDevice(s, s + strlen(s)) {}
};

/******************************* output classes *******************************/
class OutputDevice {
protected:
  char buffer[BUFFER_SIZE + MAX_LENGTH];
  char* output;
  char* end;
  bool separate;

  OutputDevice() : output(buffer), end(buffer + BUFFER_SIZE + MAX_LENGTH), separate(false)
  , width(setWidth().value), fill(setFill().value), base(setBase().value), precision(setPrecision().value)
  , delimiter(setDelimiter().value) { computeBasePower(); }

  virtual void writeToDevice(uint count) = 0;

  inline void flushMaybe() {
    if (__builtin_expect(output >= buffer + BUFFER_SIZE, false)) {
      writeToDevice(BUFFER_SIZE);
      output = copy(buffer + BUFFER_SIZE, output, buffer);
    }
  }

  void computeBasePower() {
    basePower = 1;
    for (uint i = 0; i < precision; ++i) basePower *= base;
  }

  template <class I> inline char* writeUnsignedInt(I arg, char* last) {
    if (__builtin_expect(arg == 0, false)) *--last = '0';
    if (__builtin_expect(base == 10, true)) {
      for (; arg; arg /= 10) *--last = '0' + arg % 10;
    } else for (; arg; arg /= base) {
      I digit = arg % base;
      *--last = digit < 10 ? '0' + digit : 'A' - 10 + digit;
    }
    return last;
  }

  template <class I> inline char* writeSignedInt(I arg, char* last) {
    auto unsignedArg = static_cast<typename make_unsigned<I>::type>(arg);
    if (arg < 0) {
      last = writeUnsignedInt(~unsignedArg + 1, last);
      *--last = '-';
      return last;
    }
    return writeUnsignedInt(unsignedArg, last);
  }

  template <class F> char* writeFloatingPoint(F arg, char* last) {
    bool negative = signbit(arg);
    if (negative) arg = -arg;
    if (isnan(arg)) for (int i = 0; i < 3; ++i) *--last = i["NaN"];
    else if (isinf(arg)) for (int i = 0; i < 3; ++i) *--last = i["fnI"];
    else {
      auto integerPart = static_cast<unsigned long long>(arg);
      auto fractionalPart = static_cast<unsigned long long>((arg - integerPart) * basePower + F(0.5));
      if (fractionalPart >= basePower) ++integerPart, fractionalPart = 0;
      char* point = last - precision;
      if (precision > 0) {
        ::fill(point, writeUnsignedInt(fractionalPart, last), '0');
        *--point = '.';
      }
      last = writeUnsignedInt(integerPart, point);
    }
    if (negative) *--last = '-';
    return last;
  }

  inline int writeT(char* first) {
    int delimiterLenght = separate ? writeDelimiter() : 0;
    separate = true;
    uint charsWritten = static_cast<uint>(end - first);
    if (__builtin_expect(charsWritten < width, false))
      charsWritten += writeFill(width - charsWritten);
    output = copy(first, end, output);
    flushMaybe();
    return delimiterLenght + static_cast<int>(charsWritten);
  }

  inline int writeFill(uint count) {
    int charsWritten = static_cast<int>(count);
    if (__builtin_expect(output + count + MAX_LENGTH < end, true)) {
      if (count == 1) *output++ = fill;
      else output = fill_n(output, count, fill);
    } else for (uint chunkSize = static_cast<uint>(buffer + BUFFER_SIZE - output);; chunkSize = BUFFER_SIZE) {
      if (chunkSize > count) chunkSize = count;
      output = fill_n(output, chunkSize, fill);
      flushMaybe();
      if ((count -= chunkSize) == 0) break;
    }
    return charsWritten;
  }

public:
  uint width;
  char fill;
  uint base;
  uint precision;
  unsigned long long basePower;
  string delimiter;

  OutputDevice(OutputDevice const&) = delete;
  OutputDevice& operator = (OutputDevice const&) = delete;
  virtual ~OutputDevice() {};

  inline int writeChar(char arg) { separate = false; *output++ = arg; flushMaybe(); return 1; }

  inline int writeString(const char* arg, size_t length, bool checkWidth = true) {
    separate = false;
    uint count = static_cast<uint>(length);
    int charsWritten = static_cast<int>(count) + (checkWidth && count < width ? writeFill(width - count) : 0);
    if (__builtin_expect(output + count + MAX_LENGTH < end, true)) {
      if (count == 1) *output++ = *arg;
      else output = copy_n(arg, count, output);
    } else for (uint chunkSize = static_cast<uint>(buffer + BUFFER_SIZE - output);; chunkSize = BUFFER_SIZE) {
      if (chunkSize > count) chunkSize = count;
      output = copy_n(arg, chunkSize, output);
      flushMaybe();
      if ((count -= chunkSize) == 0) break;
      arg += chunkSize;
    }
    return charsWritten;
  }

  inline int writeDelimiter() { return writeString(delimiter.c_str(), delimiter.size(), false); }

  inline void flush() {
    writeToDevice(static_cast<uint>(output - buffer));
    output = buffer;
  }

  // property setters
  inline int write(Detail::Width newWidth) { width = newWidth.value; return 0; }
  inline int write(Detail::Fill newFill) { fill = newFill.value; return 0; }
  inline int write(Detail::Base newBase) { base = newBase.value; computeBasePower(); return 0; }
  inline int write(Detail::Precision newPrecision) {
    precision = newPrecision.value; computeBasePower(); return 0;
  }
  inline int write(Detail::Delimiter newDelimiter) { delimiter = newDelimiter.value; return 0; }
  // primitive types
  inline int write() { return 0; }
  inline int write(char arg) { return writeChar(arg); }
  template <class I> inline typename enable_if<is_integral<I>::value && is_unsigned<I>::value,
  int>::type write(I arg) { return writeT(writeUnsignedInt(arg, end)); }
  template <class I> inline typename enable_if<is_integral<I>::value && is_signed<I>::value,
  int>::type write(I arg) { return writeT(writeSignedInt(arg, end)); }
  template <class F> inline typename enable_if<is_floating_point<F>::value,
  int>::type write(F arg) { return writeT(writeFloatingPoint(arg, end)); }
  // complex types
  inline int write(const char* arg) { return writeString(arg, strlen(arg)); }
  template <int N>
  inline int write(char (&arg)[N]) { return writeString(arg, strlen(arg)); }
  inline int write(const string& arg) { return writeString(arg.c_str(), arg.size()); }
  template <class T1, class T2>
  inline int write(const pair<T1, T2>& arg) {
    int charsWritten = write(arg.first);
    charsWritten += writeDelimiter();
    return charsWritten + write(arg.second);
  }
  template <class T>
  inline int write(const complex<T>& arg) { return write(real(arg), imag(arg)); }
  // ranges
  template <class Iterator, class... Ts> inline typename enable_if<is_iterator<Iterator>::value,
  int>::type write(Iterator first, Iterator last, Ts&&... args) {
    int charsWritten = 0;
    for (; first != last; charsWritten += ++first == last ? 0 : writeDelimiter()) charsWritten += write(*first);
    return charsWritten + write(forward<Ts>(args)...);
  }
  template <class Iterator, class I, class... Ts>
  inline typename enable_if<is_iterator<Iterator>::value && is_integral<I>::value,
  int>::type write(Iterator first, I count, Ts&&... args) { return write(first, first + count, forward<Ts>(args)...); }
  // generic forwarding
  template <class T>
  inline auto write(const T& arg) -> decltype(arg.write(*this)) { return arg.write(*this); }
  template <class T0, class T1, class... Ts> inline typename enable_if<!is_iterator<T0>::value,
  int>::type write(T0&& arg0, T1&& arg1, Ts&&... args) {
    int charsWritten = write(forward<T0>(arg0));
    return charsWritten + write(forward<T1>(arg1), forward<Ts>(args)...);
  }
};

class OutputFile : public OutputDevice {
  FILE* file;
  bool owner;

  void writeToDevice(uint count) override {
    fwrite(buffer, 1, count, file);
    fflush(file);
  }

public:
  OutputFile(FILE* file = stdout, bool takeOwnership = false) : file(file), owner(takeOwnership) {}
  OutputFile(const char* fileName) : OutputFile(fopen(fileName, "w"), true) {}
  ~OutputFile() override { flush(); if (owner) fclose(file); }
};

class OutputString : public OutputDevice {
  string& str;

  void writeToDevice(uint count) override { str.append(buffer, count); }

public:
  OutputString(string& str) : OutputDevice(), str(str) {}
  ~OutputString() override { flush(); }
};

unique_ptr<InputDevice> input;
unique_ptr<OutputDevice> output;

template <class... Ts> inline bool read(Ts&&... args) { return input->read(forward<Ts>(args)...); }
template <class... Ts> inline int write(Ts&&... args) { return output->write(forward<Ts>(args)...); }
template <class... Ts> inline int writeln(Ts&&... args) { return write(forward<Ts>(args)..., '\n'); }
void flush() { output->flush(); }

#define int long long
const int maxn = 200000 + 5;
const int maxd = 16;
int a[maxn], d[maxn][maxd];
vector<unordered_map<int, int> > v;
int turn(int x){
	int c = 0;
	while(x){
		c++;
		x /= 10;
	}
	return c;
}
main(){
  input.reset(new InputFile(stdin, false));
  output.reset(new OutputFile());
	int N, K; read(N, K);
	v.resize(maxd);
	for(int i = 0; i < N; i++){
		read(a[i]);
		for(unsigned long long k = 1, j = 0; j < maxd; k *= 10, j++){
			int q = (int)((a[i] * k) % K);
			d[i][j] = q;
			v[j][q] = v[j][q] + 1;
		}
	}
	int ans = 0;
	for(int i = 0; i < N; i++){
		int p = d[i][0];
		int t = turn(a[i]);
		auto it =  v[t].find((K - p) % K);
		if(it != v[t].end()){
			ans += it -> r;
			if((d[i][t] + p) % K == 0){ ans--;}
		}
	}
	cout << ans << ed;
}


#include<bits/stdc++.h>
using namespace std;
#define l first
#define r second
#define ed '\n'
#define INF 0x3f3f3f3f
#define cl(x, v) for(auto &w : x) w = v
#define all(x) begin(x), end(x)
#define sz(x) ((int)(x).size())
#define OUTIO ios_base::sync_with_stdio(0); cin.tie(0)
#define TIME cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"
#ifdef AC
	#define FILEIO \
		freopen("r.in", "r", stdin); \
		freopen("w.out", "w", stdout)
#else
	#define FILEIO
#endif
#define debug(...) do{\
	cerr << __PRETTY_FUNCTION__ << " - " << __LINE__ << ": (" << #__VA_ARGS__ << ") = ";\
	_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I && x){
	cerr << x << endl;
}
template<typename I,typename...T> void _DO(I && x, T && ...tail){
	cerr << x << ", ";
	_DO(tail...);
}
template<typename A, typename B>
ostream& operator <<(ostream &s, const pair<A, B> &p) {
	return s << "(" << p.first << "," << p.second << ")";
}
template<typename T>
ostream& operator <<(ostream &s, const vector<T> &c) {
	s << "[ "; for (auto it : c) s << it << " "; s << "]";
	return s;
}
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
#define int long long
const int maxn = 200000 + 5;
const int maxd = 11;
int a[maxn], d[maxn][maxd];
multiset<pair<int, int> > S;
int turn(int x){
	int c = 0;
	while(x){
		c++;
		x /= 10;
	}
	return c;
}
main(){
	OUTIO; FILEIO;
	int N, K; cin >> N >> K;
	for(int i = 0; i < N; i++){
		cin >> a[i];
		for(long long k = 1, j = 0; j < maxd; k *= 10, j++){
			int q = (int)((a[i] * k) % K);
			d[i][j] = q;
			S.insert({j, q});
		}
	}
	int ans = 0;
	for(int i = 0; i < N; i++){
		int p = d[i][0];
		int t = turn(a[i]);
		int f = p ? (K - p) : p ;
		int sum = S.count({t, f});
		if(sum){
			ans += sum;
			if((d[i][t] + p) % K == 0) ans--;
		}
	}
	cout << ans << ed;
	TIME;
}


#include<bits/stdc++.h>
using namespace std;
#define l first
#define r second
#define ed '\n'
#define INF 0x3f3f3f3f
#define cl(x, v) for(auto &w : x) w = v
#define all(x) begin(x), end(x)
#define sz(x) ((int)(x).size())
#define OUTIO ios_base::sync_with_stdio(0); cin.tie(0)
#define TIME cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"
#ifdef AC
	#define FILEIO \
		freopen("r.in", "r", stdin); \
		freopen("w.out", "w", stdout)
#else
	#define FILEIO
#endif
#define debug(...) do{\
	cerr << __PRETTY_FUNCTION__ << " - " << __LINE__ << ": (" << #__VA_ARGS__ << ") = ";\
	_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I && x){
	cerr << x << endl;
}
template<typename I,typename...T> void _DO(I && x, T && ...tail){
	cerr << x << ", ";
	_DO(tail...);
}
template<typename A, typename B>
ostream& operator <<(ostream &s, const pair<A, B> &p) {
	return s << "(" << p.first << "," << p.second << ")";
}
template<typename T>
ostream& operator <<(ostream &s, const vector<T> &c) {
	s << "[ "; for (auto it : c) s << it << " "; s << "]";
	return s;
}
typedef long long ll;
typedef unsigned long long ULL;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
const int maxn = 200000 + 5;
const int maxd = 11;
int a[maxn], d[maxn][maxd];
vector<map<ll, ll> > v;
int turn(int x){
	int c = 0;
	while(x){
		c++;
		x /= 10;
	}
	return c;
}
int main(){
	OUTIO; FILEIO;
	int N, K; cin >> N >> K;
	v.resize(maxd);
	for(int i = 0; i < N; i++){
		cin >> a[i];
		for(ll k = 1, j = 0; j < maxd; k *= 10, j++){
			int q = ((a[i] * k) % K);
			d[i][j] = q;
			v[j][q] = v[j][q] + 1;
		}
	}
	/*
	for(int i = 0; i < maxd; i++){
		for(auto it = v[i].begin(); it != v[i].end(); it++)
			cout << it -> l << ' ' << it -> r << ed;
		cout << ed;
	}
	*/
	ll ans = 0;
	for(int i = 0; i < N; i++){
		int p = d[i][0];
		int t = turn(a[i]);
		auto it =  v[t].find((K - p) % K);
		if(it != v[t].end()){
			ans += it -> r;
			//cout <<  i << ' ' << it -> r << ed;
			if((d[i][t] + p) % K == 0) ans--;
		}
	}
	cout << ans << ed;
	TIME;
}


#include<bits/stdc++.h>
using namespace std;
#define l first
#define r second
#define ed '\n'
#define INF 0x3f3f3f3f
#define cl(x, v) for(auto &w : x) w = v
#define all(x) begin(x), end(x)
#define sz(x) ((int)(x).size())
#define OUTIO ios_base::sync_with_stdio(0); cin.tie(0)
#define TIME cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"
#ifdef AC
	#define FILEIO \
		freopen("r.in", "r", stdin); \
		freopen("w.out", "w", stdout)
#else
	#define FILEIO
#endif
#define debug(...) do{\
	cerr << __PRETTY_FUNCTION__ << " - " << __LINE__ << ": (" << #__VA_ARGS__ << ") = ";\
	_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I && x){
	cerr << x << endl;
}
template<typename I,typename...T> void _DO(I && x, T && ...tail){
	cerr << x << ", ";
	_DO(tail...);
}
template<typename A, typename B>
ostream& operator <<(ostream &s, const pair<A, B> &p) {
	return s << "(" << p.first << "," << p.second << ")";
}
template<typename T>
ostream& operator <<(ostream &s, const vector<T> &c) {
	s << "[ "; for (auto it : c) s << it << " "; s << "]";
	return s;
}
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
#define int long long
const int maxn = 200000 + 5;
const int maxd = 11;
int a[maxn], d[maxn][maxd];
vector<int> v[maxd];
int turn(int x){
	int c = 0;
	while(x){
		c++;
		x /= 10;
	}
	return c;
}
main(){
	OUTIO; FILEIO;
	int N, K; cin >> N >> K;
	for(int i = 0; i < N; i++){
		cin >> a[i];
		for(unsigned long long k = 1, j = 0; j < maxd; k *= 10, j++){
			int q = (int)((a[i] * k) % K);
			d[i][j] = q;
			v[j].push_back(q);
		}
	}
	for(int i = 0; i < maxd; i++)
		sort(v[i].begin(), v[i].end());
	int ans = 0;
	for(int i = 0; i < N; i++){
		int p = d[i][0];
		int t = turn(a[i]);
		int f = p ? (K - p) : p ;
		auto l =  lower_bound(v[t].begin(), v[t].end(), f);
		auto r =  upper_bound(v[t].begin(), v[t].end(), f);
		int sum = r - l;
		if(sum){
			ans += sum;
			if((d[i][t] + p) % K == 0) ans--;
		}
	}
	cout << ans << ed;
	TIME;
}


#include<bits/stdc++.h>
using namespace std;
#define l first
#define r second
#define ed '\n'
#define INF 0x3f3f3f3f
#define cl(x, v) for(auto &w : x) w = v
#define all(x) begin(x), end(x)
#define sz(x) ((int)(x).size())
#define OUTIO ios_base::sync_with_stdio(0); cin.tie(0)
#define TIME cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"
#ifdef AC
	#define FILEIO \
		freopen("r.in", "r", stdin); \
		freopen("w.out", "w", stdout)
#else
	#define FILEIO
#endif
#define debug(...) do{\
	cerr << __PRETTY_FUNCTION__ << " - " << __LINE__ << ": (" << #__VA_ARGS__ << ") = ";\
	_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I && x){
	cerr << x << endl;
}
template<typename I,typename...T> void _DO(I && x, T && ...tail){
	cerr << x << ", ";
	_DO(tail...);
}
template<typename A, typename B>
ostream& operator <<(ostream &s, const pair<A, B> &p) {
	return s << "(" << p.first << "," << p.second << ")";
}
template<typename T>
ostream& operator <<(ostream &s, const vector<T> &c) {
	s << "[ "; for (auto it : c) s << it << " "; s << "]";
	return s;
}
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
#define int long long
const int maxn = 200000 + 5;
const int maxd = 11;
int a[maxn], d[maxn][maxd];
vector<int> v[maxd];
int turn(int x){
	int c = 0;
	while(x){
		c++;
		x /= 10;
	}
	return c;
}
main(){
	OUTIO; FILEIO;
	int N, K; cin >> N >> K;
	for(int i = 0; i < N; i++){
		cin >> a[i];
		for(long long k = 1, j = 0; j < maxd; k *= 10, j++){
			int q = (int)((a[i] * k) % K);
			d[i][j] = q;
			v[j].push_back(q);
		}
	}
	for(int i = 0; i < maxd; i++)
		sort(v[i].begin(), v[i].end());
	int ans = 0;
	for(int i = 0; i < N; i++){
		int p = d[i][0];
		int t = turn(a[i]);
		int f = p ? (K - p) : p ;
		auto l = lower_bound(v[t].begin(), v[t].end(), f);
		auto r = upper_bound(v[t].begin(), v[t].end(), f);
		int sum = r - l;
		if(sum){
			ans += sum;
			if((d[i][t] + p) % K == 0) ans--;
		}
	}
	cout << ans << ed;
	TIME;
}