Harryxun/stf_run huggingface dataset:
N = int(input())
K = int(input())
SN = str(N)
LN = list(SN)
keta =len(LN)
Nzer = keta-K
Nsei = K
output = 0
if keta>=K:
    output += comb(keta,K,10**9+7)*9**K
    t = 0
    while K-1-t>=0:
        output -= (9-int(LN[t]))*comb(keta-1-t,K-1-t,10**9+7)*9**(K-1-t)
        t += 1
print(output)

### FIXED CODE ###

def framod(n, mod, a=1):
    for i in range(1,n+1):
        a=a * i % mod
    return a
def power(n, r, mod):
    if r == 0: return 1
    if r%2 == 0:
        return power(n*n % mod, r//2, mod) % mod
    if r%2 == 1:
        return n * power(n, r-1, mod) % mod
def comb(n, k, mod):
    a=framod(n, mod)
    b=framod(k, mod)
    c=framod(n-k, mod)
    return (a * power(b, mod-2, mod) * power(c, mod-2, mod)) % mod



N = int(input())
K = int(input())
SN = str(N)
LN = list(SN)
keta =len(LN)
Nzer = keta-K
Nsei = K
output = 0
if keta>=K:
    output += comb(keta,K,10**9+7)*9**K
    t = 0
    s = 0
    while (s<=K-1)and(t<=keta-1):
        if LN[t]!="0":
            output -= (9-int(LN[t]))*comb(keta-1-t,K-1-s,10**9+7)*9**(K-1-s)
            t += 1
            s += 1
        elif LN[t]=="0":
            output -= (9-int(LN[t]))*comb(keta-1-t,K-1-s,10**9+7)*9**(K-1-s)
            t+=1
print(int(output))
N = int(input())

n1 = 8*N+1
a = int(n1**0.5)

if n1==a**2:
    n = (-3+a)//2
    if (-3+a)%2:
        print("No")
    else:
        d = [[0]*(n+1) for _ in range(n+2)]
        d[0][0] = 1
        d[0][1] = 2
        d[1][0] = 2
        d[1][1] = 3
        d[2][0] = 3
        d[2][1] = 1
        for i in range(1, n):
            v = 4+((i-1)*(i+4)//2)
            c = 2+i

            for j in range(c):
                d[c][j] = v+j
                d[j][c-1] = v+j

        print("Yes")
        print(n+2)
        for i in range(n+2):
            print(n+1, *d[i], sep=" ")
else:
    print("No")

### FIXED CODE ###

N = int(input())

n1 = 8*N+1
a = int(n1**0.5)

if N==1:
    print("Yes")
    print(2)
    print(1, 1)
    print(1, 1)
elif N>=3 and n1==a**2:
    n = (-3+a)//2
    if (-3+a)%2:
        print("No")
    else:
        d = [[0]*(n+1) for _ in range(n+2)]
        d[0][0] = 1
        d[0][1] = 2
        d[1][0] = 2
        d[1][1] = 3
        d[2][0] = 3
        d[2][1] = 1
        for i in range(1, n):
            v = 4+((i-1)*(i+4)//2)
            c = 2+i

            for j in range(c):
                d[c][j] = v+j
                d[j][c-1] = v+j

        print("Yes")
        print(n+2)
        for i in range(n+2):
            print(n+1, *d[i], sep=" ")
else:
    print("No")
square = []
while True:
    data = [int(e) for e in input().split()]
    if data == []:
        break
    square.append(data)
    
for i in range(len(square)):
    for j in range(square[i][0]):
        for k in range(square[i][1]):
            print("#", end="")
        print()


### FIXED CODE ###

square = []
while True:
    data = [int(e) for e in input().split()]
    if data[0]==0 and data[1]==0:
        break
    square.append(data)
    
for i in range(len(square)):
    for j in range(square[i][0]):
        for k in range(square[i][1]):
            print("#", end="")
        print()
    print()
n,a,b = map(int,input().split())

for i in range(n):
  sum=0
  t=i
  while t>0:
    sum += t%10
    t = (t-t%10)/10
  if a <= sum <= b:
    count += i
  
print(count)



### FIXED CODE ###

n,a,b = map(int,input().split())
count=0

for i in range(1,n+1):
  sum=0
  t=i
  while t>0:
    sum += t%10
    t = (t-t%10)/10
  
  if a <= sum <= b:
    count += i
  
print(count)
n, k = map(int, input().split())
A = list(map(int, input().split()))

Town = []
#まだ訪れていない町は-1
rec = [-1] * (n+1)
idx = 1
#すべての町を訪れるまで
while rec[idx] == -1:
    rec[idx] = len(Town)
    Town.append(idx)
    idx = A[idx-1]

Exce = rec[idx]
Cycl = len(Town) - Exce

if Cycl >= k:
    print(Town[k])
else:
    k -= Exce
    k %= Cycl
    print(Town[k+Exce])

### FIXED CODE ###

n, k = map(int, input().split())
A = list(map(int, input().split()))

Town = []
#まだ訪れていない町は-1
rec = [-1] * (n+1)
idx = 1
#周期までループをまわす
while (rec[idx] == -1):
    rec[idx] = len(Town)
    Town.append(idx)
    idx = A[idx-1]

#周期前
Exce = rec[idx]
#周期内
Cycl = len(Town) - Exce

if Exce > k:
    print(Town[k])
else:
    Warp = (k - Exce) % Cycl
    print(Town[Exce+Warp])
n = int(input())
s = input()
if n%2==0:
    a = s[0:(n/2-1)]
    b = s[(n/2):]
    if a==b:
        print("Yes")
else:
    print("No")

### FIXED CODE ###

n = int(input())
s = input()
if n%2==0:
    a = s[0:(int(n/2))]
    b = s[(int(n/2)):n]
    if a==b:
        print("Yes")
    else:
        print("No")
else:
    print("No")
A , B , M = int(input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = []
for i in range(M-1):
    q = input().split()
    x = a[q[0]-1] + b[q[1]-1] - q[2]
    ans.append(x)
print(min(ans))

### FIXED CODE ###

A , B , M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = [min(a) + min(b)]
for i in range(M):
    q = list(map(int, input().split()))
    x = a[q[0]-1] + b[q[1]-1] - q[2]
    ans.append(x)
print(min(ans))
N = int(input())
H = list(map(int, input().split()))
ok = True
for i in range(N - 2):
    if (H[i] > H[i + 1] and H[i + 1] > H[i + 2]) or H[i]-H[i+1]>1:
        ok = False
if H[-2] - H[-1] > 1:
    ok = False
if ok:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

N = int(input())
H = list(map(int, input().split()))

for i in range(1,N):
    if H[i-1] > H[i]:
        print("No")
        exit()

    if H[i-1] < H[i]:
        H[i] -= 1

print("Yes")
#HATAGAYA
words = ''
w = []
flag = []
S = list(input())
for i in range(len(S)):
  if S[i] == 'A' or S[i] == 'T' or S[i] == 'G' or S[i] == 'C':
    flag.append('True')
  else:
    flag.append('False')

for j in range(len(S)):
  if flag[j] == 'True':
  	words += S[j]
  elif flag[j] == 'False':
    w.append(words)
    words = ''

print(len(max(w)))

### FIXED CODE ###

count = 0
MAX = 0
S = list(input())
for i in range(len(S)):
  if S[i] == 'A' or S[i] == 'T' or S[i] == 'G' or S[i] == 'C':
    count += 1
    if MAX < count:
        MAX = count
  else:
    count = 0

print(MAX)
a, b, k = input().split()
takahashi = a - k
aoki = b + takahashi if takahashi < 0 else b
print(f"{max(takahashi, 0)} {max(aoki, 0)}")

### FIXED CODE ###

a, b, k = (int(i) for i in input().split())
takahashi = a - k
aoki = b + takahashi if takahashi < 0 else b
print("{} {}".format(max(takahashi, 0), max(aoki, 0)))
x=input()
if x >=400 and 599<=x:
  print("8")
if x >=600 and 799<=x:
  print("7")
if x >=800 and 999<=x:
  print("6")
if x >=1000 and 1199<=x:
  print("5")
if x >=1200 and 1399<=x:
  print("4")
if x >=1400 and 1599<=x:
  print("3")
if x >=1600 and 1799<=x:
  print("2")
if x >=1800 
  print("1")
  

### FIXED CODE ###

x=int(input())
if x >=400 and 599>=x:
  print("8")
if x >=600 and 799>=x:
  print("7")
if x >=800 and 999>=x:
  print("6")
if x >=1000 and 1199>=x:
  print("5")
if x >=1200 and 1399>=x:
  print("4")
if x >=1400 and 1599>=x:
  print("3")
if x >=1600 and 1799>=x:
  print("2")
if x >=1800:
  print("1")
S = list(input())
K = int(input())
S2 = S[:]

if len(S) == 1:
    print(K//2)
    exit()
cons = 0
for i in range(len(S)-1):
    if S[i] == S[i+1]:
        cons += 1
        S[i+1] = '_'
if K == 1:
    print(cons)
    exit()
if S[0] != S[-1]:
    print(cons * K)
    exit()

# 最初から何文字連続するか
# この時最後の連続する文字はすでに奇数でかつ最初の文字と一緒
cons2 = 1
j = 0
while True:
    if S2[j] == S2[j+1]:
        cons2 += 1
        j += 1
    else:
        break
if cons2 % 2 == 0:
    minus = 0
else:
    minus = 1
print(cons * K + minus * (K-1) )

### FIXED CODE ###

S = list(input())
K = int(input())
S2 = S[:]

if len(S) == 1:
    print(K//2)
    exit()
cons = 0
for i in range(len(S)-1):
    if S[i] == S[i+1]:
        cons += 1
        S[i+1] = '_'
if K == 1:
    print(cons)
    exit()
if S[0] != S[-1]:
    print(cons * K)
    exit()
cons3 = 0
if len(set(S2)) == 1:
    S2 = S2 * 2 + ['']
    for i in range(len(S2) - 1):
        if S2[i] == S2[i+1]:
            cons3 += 1
            S2[i+1] = '_'
    print(cons3 * (K//2) + cons * (K%2))
    exit()
# 最初から何文字連続するか
# この時最後の連続する文字はすでに奇数でかつ最初の文字と一緒
cons2 = 1
j = 0
while True:
    if S2[j] == S2[j+1]:
        cons2 += 1
        j += 1
    else:
        break
if cons2 % 2 == 0:
    minus = 0
else:
    minus = 1
print(cons * K + minus * (K-1) )
N = int(input())
S = input()
for w in 'abcdefghijklmnopqrstuvwxyz':
  if S.find(w) != -1:
    while S.count(w) != 1:
   		 if S[S.find(w) + 1] == w:
    	 	 S.replace(w + w,w)
print(len(S))

### FIXED CODE ###

N = int(input())
S = input()
ans = 1
for i in range(N):
  if i <= len(S)-2:
    if S[i] !=S[i+1]:
      ans = ans + 1
print(ans)
b = input()
if b == "A":
  b = "T"
else if b == "T":
  b = "A"
else if b == "C":
  b = "G"
else if b == "G":
  b = "C"
print(b)

### FIXED CODE ###

b = input()
if b == "A":
  b = "T"
elif b == "T":
  b = "A"
elif b == "C":
  b = "G"
elif b == "G":
  b = "C"
print(b)
a,b=int(input().split())
c=a+b
if c%2==0:
  print(c/2)
else:
  print("IMPOSSIBLE")

### FIXED CODE ###

a,b=map(int,input().split())
c=a+b
if c%2==0:
  print(int(c/2))
else:
  print("IMPOSSIBLE")
N = int(input())

S = 'abcdefghijklmnopqrstuvwxyz'

def bite(X):
    s = 0
    t = 0
    while t < X:
        t = t + 26**(s+1)
        s = s + 1
    return s

B = bite(N)
X = N
L = []
for i in range(B-1):
    L.append(X//(26**(B-i-1)))
    X = X - (X//(26**(B-i-1)))*(26**(B-i-1))
L.append(X)

ans = ''
for i in range(B):
    ans = ans + S[L[i]-1]
    
print(ans)

### FIXED CODE ###

N = int(input())

S = 'abcdefghijklmnopqrstuvwxyz'

def bite(X):
    s = 0
    t = 0
    while t < X:
        t = t + 26**(s+1)
        s = s + 1
    return s


B = bite(N)
X = N
L = []
for i in range(B):
    if X%26 != 0:
        L.append(X%26)
        X = (X-X%26)//26
    else:
        L.append(26)
        X = (X - 26)//26

L.reverse()

ans = ''
for i in range(B):
    ans = ans + S[L[i]-1]

    
print(ans)
import sys
inputs = sys.stdin.readlines()

n, q = list(map(int, inputs[0].split()))
edges = []
for i in range(n-1):
    edges.append(tuple(map(int, inputs[i+1].split())))
p_x_list = []
for i in range(q):
    p_x_list.append(tuple(map(int, inputs[n+i].split())))
    
from collections import deque

def dfs_generator(nodes, start):
    nexts = deque([start])
    while nexts:
        node = nexts.popleft()
        nexts.extend(nodes[node]['childs'])
        yield node

nodes = dict({1: dict({'val': 0, 'parent': 0, 'childs': []})})
for from_, to_ in edges:
    nodes[from_]['childs'].append(to_)
    nodes[to_] = dict({'val': 0, 'parent': from_, 'childs': []})

for p, x in p_x_list:
    gen = dfs_generator(nodes, p)
    try:
        while True:
            nodes[next(gen)]['val'] += x
    except StopIteration:
        pass

for i in range(n-1):
    print(str(nodes[i+1]['val']), end=' ')
print(str(nodes[i+2]['val']))


### FIXED CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N,Q = map(int,readline().split())
ABPX = list(map(int,read().split()))
AB = iter(ABPX[:N+N-2])
PX = iter(ABPX[N+N-2:])

graph = [[] for _ in range(N+1)]
for a,b in zip(AB,AB):
    graph[a].append(b)
    graph[b].append(a)

val = [0] * (N+1)
for p,x in zip(PX,PX):
    val[p] += x

stack = [1]

parent = [0] * (N+1)
while stack:
    x = stack.pop()
    for y in graph[x]:
        if y == parent[x]:
            continue
        parent[y] = x
        stack.append(y)
        val[y] += val[x]

print(' '.join(map(str,val[1:])))
a = input()
b = input()

x = a*b

y = int(x)

print(x)

### FIXED CODE ###

A,B=input().split()
A = int(A)
B1,B2 = B.split(".")
t = A*(int(B1)*100 + int(B2))
print(int(t//100))
n, k = map(int, input().split())
h = sorted([int(input()) for _ in range(n)])
ans = 1000000000

for i in range(n - k + 1):
    ans = min(ans, h[i + k - 11] - h[i])

print(ans)


### FIXED CODE ###

n, k = map(int, input().split())
h = sorted([int(input()) for _ in range(n)])
ans = 1000000000

for i in range(n - k + 1):
    ans = min(ans, h[i + k - 1] - h[i])

print(ans)
w=['Sunny', 'Cloudy', 'Rainy']
print(w[(w.index(input)+1)%3])

### FIXED CODE ###

w=['Sunny', 'Cloudy', 'Rainy']
print(w[(w.index(input())+1)%3])
from fractions import gcd

def lcm(c,d):
    return c//gcd(c,d)*d
mod=10**9+7
n=int(input())
a=[int(i) for i in input().split()]
l=a[0]
for i in range(1,n):
    l=lcm(l,a[i])
ans=0
for i in range(n):
    ans+=l//a[i]
    #ans%=mod
print(ans%=mod)


### FIXED CODE ###

from fractions import gcd

def lcm(c,d):
    return c//gcd(c,d)*d
mod=10**9+7
n=int(input())
a=[int(i) for i in input().split()]
l=a[0]
for i in range(1,n):
    l=lcm(l,a[i])
ans=0
for i in range(n):
    ans+=l//a[i]
    #ans%=mod
print(ans%mod)
a, b, k = map(int, input().split())
cand = list(range(a, b+1))

# res = sorted(list(set(cand[:k] + cand[-k:])))
# for i in res:
#     print(i)
# last = 0
# for so in range(a, a+k, 1):
#     if so <= b:
#         print(so)
#         last = so

# for lo in range(b-(k-1), b+1, 1):
#     if last < lo and lo <= b:
#         print(lo)

S=sorted(set(range(a,min(a+k,b+1))) | set(range(max(b+1-k,a),b+1)))
for _ in S:
    print(_)

### FIXED CODE ###

a, b, k = map(int, input().split())
S=sorted(set(range(a,min(a+k,b+1))) | set(range(max(b+1-k,a),b+1)))
for _ in S:
    print(_)
a,b=map(int,input())
if a < 9 and b < 9:
  print('Yay!')
else:
  print(':(')

### FIXED CODE ###

a,b=map(int,input().split())
if a < 9 and b < 9:
  print('Yay!')
else:
  print(':(')
Z = int(input())
n = (-2)

ans = ""

while abs(Z) >= 1:
  r = Z % n
  if r < 0:
    r = r + 2
  Z = int((Z - r) / n)
  ans += str(r)
  
print(int(ans))

### FIXED CODE ###

Z = int(input())

if Z == 0:
  print(0)

else:
  n = (-2)

  ans = ""

  while abs(Z) >= 1:
    r = Z % n
    if r < 0:
      r = r + 2
    Z = int((Z - r) / n)
    ans += str(r)

  ans = "".join(list(reversed(ans)))


  print(int(ans))
n=int(input())
a=[]
sum=0
for i in range(n):
  a.append(list(map(int,input().split())))
  if a[i][1]=="BTC":
    sum+=a[i][0]*380000.0
  else:
    sum+=a[i][0]
print(sum)

### FIXED CODE ###

n=int(input())
a=[]
sum=0
for i in range(n):
  a.append(list(input().split()))
  if a[i][1]=="BTC":
    sum+=float(a[i][0])*380000.0
  else:
    sum+=int(a[i][0])
print(sum)
n = int(input())
e = [0] * (n-1)

# 素因数分解する  
for i in range(2, n+1):
    cur = i
    for j in range(2, i+1):
        # ひたすら割り算を繰り返す
        # 2で割り続ければ、4で割ろうとした時には2で割れない数になっている
        # 自動的に素因数分解ができる
        while cur % j == 0:
            e[j] += 1
            cur //= j

def num(m):
    return len([i for i in e if i >= m-1])

print(num(75) + num(25) * (num(3) - 1) + num(15) * (num(5) - 1) \
      + num(5) * (num(5) - 1) * (num(3) - 2) // 2)

### FIXED CODE ###

n = int(input())
e = [0] * (n+1)

# 素因数分解する  
for i in range(2, n+1):
    cur = i
    for j in range(2, i+1):
        # ひたすら割り算を繰り返す
        # 2で割り続ければ、4で割ろうとした時には2で割れない数になっている
        # 自動的に素因数分解ができる
        while cur % j == 0:
            e[j] += 1
            cur //= j

def num(m):
    return len([i for i in e if i >= m-1])

print(num(75) + num(25) * (num(3) - 1) + num(15) * (num(5) - 1) \
      + num(5) * (num(5) - 1) * (num(3) - 2) // 2)
N = int(input())
if N % 2 == 0:
  print(0.5)
else:
  print((N-(N-1))/2N)


### FIXED CODE ###

N = int(input())
if N % 2 == 0:
  print(0.5000000000)
else:
  print((N+1)/(2*N))
mod = 10**9+7
from math import factorial
def comb(n,k):
    return int(factorial(n)/(factorial(n-k)*factorial(k))) % mod

N,K = map(int,input().split())

if N==K:
    print(1)
    for i in range(K-1):
        print(0)

else:
    for i in range(1,K+1):
        blue=0
        red=0

        if K>=i:
            blue=comb(K-1,i-1)
        for j in [i-1,i,i+1]:
            if N-K>=j and j>0:
                if i!=j:
                    red += comb(N-K-1,j-1)
                else:
                    red += 2*comb(N-K-1,j-1) % mod
        print(blue*red % mod)


### FIXED CODE ###

mod = 10**9+7
from math import factorial

N,K = map(int,input().split())

def comb(n,k):
    if (k<0 or k>n):
        return 0
    k = min(k,n-k)
    return g1[n]*g2[k]*g2[n-k] % mod

g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

if N==K:
    print(1)
    for i in range(K-1):
        print(0)

else:
    for i in range(1,K+1):
        blue=0
        red=0

        if K>=i:
            blue=comb(K-1,i-1)
        for j in [i-1,i,i+1]:
            if N-K>=j and j>0:
                if i!=j:
                    red += comb(N-K-1,j-1)
                else:
                    red += 2*comb(N-K-1,j-1) % mod
        print(blue*red % mod)
N = int(input())
# A = list(map(int, input()))
A = tuple(map(int, input().split()))

from collections import defaultdict, deque
dp = defaultdict(lambda : -1)

q = deque([])
q.append( (A, 0) )

inf = float("inf")

ans = inf
while q:
    t,cost = q.popleft()
    if len(t) == 0:
        ans = min(ans, cost)
        continue
    
    tpl = t
    for i in range(len(tpl)-1):
        q.append (   ( tpl[0:i] + ( tpl[i]+tpl[i+1], )  + tpl[i+2: ],   tpl[i] + tpl[i+1] ) ) 


print(ans - sum(A))
exit(0)[

def dfs(tpl):
    if dp[tpl] != -1:
        return dp[tpl]
    if len(tpl) == 0:
        return 0
    if len(tpl) == 1:
        dp[tpl] = tpl[0]
        return tpl[0]

    lst_candidates = []
    now_cost = []
    for i in range(len(tpl)-1):
        # print("i: ", i )
        lst_candidates.append (   tpl[0:i] + ( tpl[i]+tpl[i+1], )  + tpl[i+2: ]   )
        now_cost.append ( tpl[i] + tpl[i+1] ) 

    total_cost = []
    for i in range(len(now_cost)):
        total_cost.append ( now_cost [i] + dfs(lst_candidates[i]))

    # print("totla_cost: ", total_cost)
    # print("lst_candidates: ", lst_candidates)
    res = min(total_cost)
    dp[tpl] = res

    return res

# print(dfs(A) - sum(A))


### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
inf = float("inf")

from itertools import accumulate
Accum = list(accumulate([0] + A))

dp = [ [inf]*(N+1) for _ in range(N+1)]

def dfs(l,r):
    if dp[l][r] != inf:
        return dp[l][r]
    if l == r: 
        return 0
    if l+1 == r: 
        dp[l][r] = A[l]
        return A[l]

    local_ans = inf
    for i in range(l+1, r): # 0 to 4, 0-1, 1-4
        local_ans = min(local_ans, dfs(l,i) + dfs(i,r))
    dp[l][r] = local_ans + Accum[r] - Accum[l]
    return dp[l][r]
print (dfs(0,N)- sum(A))
n,x = map(int,input().split())
X = list(map(int,input().split()))
sort_X = sorted(X)
temp = sort_X[0]
mini = X[-1]-X[0]
D = 1
if(n==1):
    print(999999999)
elif(n==2):
    print(mini)
else:
    for xx in sort_X[1:]:
        if(mini >= xx-temp):
            mini = xx-temp
        temp = xx
    for p in range(1,mini+1):
        point = x%p
        flag = True
    for xx in X:
        if(point != xx%p):
                flag = False
                break
    if(flag):
        D = p

    print(D)



### FIXED CODE ###

n,x = map(int,input().split())
X = list(map(int,input().split()))
sort_X = sorted(X)
temp = sort_X[0]
mini = float("inf")
D = 1
if(n==1):
    print(abs(X[0]-x))
elif(n==2):
    mini = min(X[-1]-x,x-X[0])

    for p in range(1,mini+1):
        point = x%p
        flag = True
        for xx in X:
            if(point != xx%p):
                    flag = False
                    break
        if(flag):
            D = p
    print(D)

else:
    for xx in sort_X[1:]:
        if(mini >= xx-temp):
            mini = xx-temp
        temp = xx
    for p in range(1,mini+1):
        point = x%p
        flag = True
        for xx in X:
            if(point != xx%p):
                    flag = False
                    break
        if(flag):
            D = p

    print(D)
import collections
import math

inp = int(input())
A = []
for a in range(inp):
    A.append(input())

def charcnt(s):
    cset = {}
    for c in s:
        if c in cset:
            cset[c] += 1
        else:
            cset[c] = 1
    sortedset = sorted(cset.items(), key=lambda x:x[0])
    s = ""
    for k, v in sortedset:
        s += k + str(v)
    return s

sorted = [charcnt(v) for v in A]    

counted = collections.Counter(sorted)
cnt = 0
for v in counted.values():
    if v > 1:
        cnt += math.factorial(v) / 2
print(int(cnt))


### FIXED CODE ###

import collections
import math

inp = int(input())
A = []
for a in range(inp):
    A.append(input())

def charcnt(s):
    cset = {}
    for c in s:
        if c in cset:
            cset[c] += 1
        else:
            cset[c] = 1
    sortedset = sorted(cset.items(), key=lambda x:x[0])
    s = ""
    for k, v in sortedset:
        s += k + str(v)
    return s

sorted = [charcnt(v) for v in A]    

def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result


counted = collections.Counter(sorted)
cnt = 0
for v in counted.values():
    if v > 1:
        cnt += cmb(v, 2)
print(int(cnt))
import math
from decimal import Decimal

a, b, c = list(map(int, input().split()))

if Decimal(a).sqrt+Decimal(b).sqrt<Decimal(c).sqrt:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

import math
from decimal import Decimal

a, b, c = list(map(int, input().split()))

if Decimal(a).sqrt()+Decimal(b).sqrt()<Decimal(c).sqrt():
  print("Yes")
else:
  print("No")
a,b=map(int,input().split())
c,d=map(int,input().split())
play_day=a-(c+d)
if play_day>=0:
    print(play_day)
else:
    print(-1)

### FIXED CODE ###

a,b=map(int,input().split())
C=list(map(int,input().split()))
play_day=a-sum(C)
if play_day>=0:
    print(play_day)
else:
    print("-1")
n = int(raw_input())
def f(words):
seen = set([words[0]])
p = words[0]
for w in words[1:]:
	if w in seen or p[-1] != w[0]: return False
	p = w
	seen.add(w)
	return True

print 'Yes' if f(raw_input().split()) else 'No'


### FIXED CODE ###

def f(words):
	seen = set([words[0]])
	p = words[0]
	for w in words[1:]:
		if w in seen or p[-1] != w[0]: return False
		p = w
		seen.add(w)
	return True

print 'Yes' if f([raw_input() for _ in range(int(raw_input()))]) else 'No'
import math
a, b = map(int, input().split)
print(math.ceil(a+b)/2)

### FIXED CODE ###

import math
a, b = map(int, input().split())
print(math.ceil((a+b)/2))
import numpy as np
def divisor_num(n):
    if n == 1:
        return 1
    arr = []
    temp = n
    for i in range(2,int(np.sqrt(n))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append(cnt)
    
    if temp!=1:
        arr.append(1)
 
    if arr==[]:
        arr.append(1)
    
    ans = 1
    for num in arr:
        ans *= num+1
    
    return ans
 
n = int(input())
total = 0
for i in range(1,n+1):
    total += i*divisor_num(i)

### FIXED CODE ###

n = int(input())

ans = 0
for i in range(1,n+1):
    num = n//i
    ans += num*(i+i*num)//2

print(ans)