Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

#float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7
n=I()
lis=LI()
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
lists=[Counter(prime_factorize(lis[i])) for i in range(n)]
C=Counter([])
for i in range(n):
    x=lists[i]
    for j in x.keys():
        C[j]=max(C[j],x[j])
#print(C)

ans=0
for i in range(n):
    x=lists[i]
    y=1
    for j in C.keys():
        y=(y*pow(j,C[j]-x[j],mod))%mod
    #print(y%mod)
    ans=(ans+y)%mod
print(ans%mod)
        
        
    
    
        
    
    


### FIXED CODE ###

#float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a // gcd(a, b) * b
#print(lcm(lcm(1000000,999999),999998))
#print(999998//2*999999)


#print(1000000*999999*999998%mod)
n=I()
lis=LI()
promod=1
LCM=1
for i in range(n):
    LCM=lcm(lis[i],LCM)
#print(LCM)
for i in range(n):
    promod=(promod*(lis[i]%mod))%mod
smmod=0
for i in range(n):
    smmod=(smmod+promod*pow(lis[i],mod-2,mod))%mod
#print(smmod)
x=(promod*pow(LCM,mod-2,mod))%mod
ans=(smmod*pow(x,mod-2,mod))%mod
print(ans)
### BUGGY CODE ###

s=input()
left,right=0,0
for i in s:
    if i=="A":
        left = s.index(i)
    elif i=="Z":
        right = s[::-1].index(i)
print(len(s)- right-left)

### FIXED CODE ###

s=input()
left,right=0,0
left = s.index("A")
right = s[::-1].index("Z")
print(len(s)- right-left)
### BUGGY CODE ###

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

max_k = M // N

for i in range(max_k)[::-1]:
    if M % (i+1) == 0:
        print(i+1)
        break

### FIXED CODE ###

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

kmax = M // N
sqrt = int(M**0.5)

k = 0
for i in range(sqrt)[::-1]:
    k1, k2 = i+1, M//(i+1)
    if M % k2 == 0 and k2 <= kmax:
        k = max(k, k2)
    elif M % k1 == 0 and k1 <= kmax:
        k = max(k, k1)

print(k)
### BUGGY CODE ###

n=int(input())
a=list(map(int,input().split()))


print(" ".join([str(a.index(i)+1) for i in range(1,n+1)]))


### FIXED CODE ###

from operator import itemgetter
n=int(input())
a=list(map(int,input().split()))

print(*[t[0] +1 for t in sorted(enumerate(a),key=itemgetter(1))])
### BUGGY CODE ###

H, W = map(int, input().split())
dist_matrix = [[-1] * W for i in range(H)]
queue = []
for i in range(H):
  line_list = list(input())
  for j in range(W):
    if line_list[j] == "#":  
      dist_matrix[i][j] = 0
      queue.append([i,j])
 
#print(queue)
while(True):
  #print(len(queue))
  if len(queue) == 0:
    break
  
  i,j = queue.pop(0)
  if i > 0 and dist_matrix[i-1][j] == -1:
    dist_matrix[i-1][j] = dist_matrix[i][j] + 1
    queue.append([i-1,j])
  if i < H-1 and dist_matrix[i+1][j] == -1:
    dist_matrix[i+1][j] = dist_matrix[i][j] + 1
    queue.append([i+1,j])
  if j > 0 and dist_matrix[i][j-1] == -1:
    dist_matrix[i][j-1] = dist_matrix[i][j] + 1
    queue.append([i,j-1])
  if j < W-1 and dist_matrix[i][j+1] == -1:
    dist_matrix[i][j+1] = dist_matrix[i][j] + 1
    queue.append([i,j+1])
  
#print(dist_matrix)
max_value = 0
for i in range(H):
  for j in range(W):
    if dist_matrix[i][j] > max_value:
      max_value = dist_matrix[i][j]
print(max_value)

### FIXED CODE ###

from collections import deque
import sys
input = sys.stdin.readline
 
H, W = map(int, input().split())
mark_matrix = [[True]*(W+2)]
#mark_matrix.extend([[True]+[False]*(W)+[True] for _ in range(H)])
mark_matrix.extend([[True]+[x!='.' for x in input()] for _ in range(H)])
mark_matrix[H].append(True)
mark_matrix.append([True]*(W+2))
#queue = []
queue = deque()
for i in range(1,H+1):
  for j in range(1,W+1):
    if mark_matrix[i][j]:
      queue.append((i,j))
#  line = input()
#  for j,ch in enumerate(line):
#    if ch == "#":
#      mark_matrix[i+1][j+1] = True
#      queue.append((i+1,j+1))
#for i in range(1,H+1):
#  mark_matrix[i][0] = True
#  mark_matrix[i][W+1] = True
#for j in range(W+2):
#  mark_matrix[0][j] = True
#  mark_matrix[H+1][j] = True
#print(mark_matrix)
 
#cnt = 0
#print(queue)
max_value = 0
while(True):
  #print(len(queue))
  if len(queue) == 0:
    break
  
  new_queue = deque()
  for i,j in queue:
  
    if not mark_matrix[i-1][j]:
      mark_matrix[i-1][j] = True
      #queue.append((i-1,j))
      new_queue.append((i-1,j))
    if not mark_matrix[i+1][j]:
      mark_matrix[i+1][j] = True
      #queue.append((i+1,j))
      new_queue.append((i+1,j))
    if not mark_matrix[i][j-1]:
      mark_matrix[i][j-1] = True
      #queue.append((i,j-1))
      new_queue.append((i,j-1))
    if not mark_matrix[i][j+1]:
      mark_matrix[i][j+1] = True
      #queue.append((i,j+1))
      new_queue.append((i,j+1))
 
  if len(new_queue) == 0:
    break
  else:
    queue = new_queue
    max_value += 1
  
#print(cnt)
#print(dist_matrix)
print(max_value)
### BUGGY CODE ###

import math

K = int(input())

sum = 0
for a in range(1, K+1) :
    for b in range(1 , K+1) :
        for c in range(1 , K+1) :
           sum = sum + math.gcd(a, math.gcd(b, c))

print(sum)


### FIXED CODE ###

import math

K = int(input())

sum = 0
for a in range(1, K+1) :
    for b in range(1 , K+1) :
        tmp = math.gcd(a, b)
        for c in range(1 , K+1) :
            sum = sum + math.gcd(tmp, c)

print(sum)
### BUGGY CODE ###

n,k = (int(x) for x in input().split())
h = list(int(x) for x in input().split())
dp = []

# i番目までの必要な体力を求める
i = 0
while i != n:

    #i = 0の時
    if i == 0:
        dp.append(0)
        i += 1
        continue

    # i = 1の時
    if i == 1:
        dp.append(abs(h[i] - h[i-1]))
        i += 1
        continue

    # i >= 2の時
    # jの値の設定
    if i - k > 0:
        j = i - k
    else:
        j = 0

    # 初めの体力を代入
    hp = dp[j] + abs(h[i] - h[j])
    j += 1
    
    while j < i:
        
        hp1 = dp[j] + abs(h[i] - h[j])
        
        # 最小の体力を求める
        if hp > hp1:
            hp = hp1

        j += 1

    # 体力の追加
    dp.append(hp)

    i += 1

print(dp[-1])
                  



### FIXED CODE ###

def main():
    n,k = map(int,input().split())
    h = list(map(int,input().split()))
    dp = [0]*n
    dp[1] = abs(h[1] - h[0])
    for i in range(2,n):
        dp[i] = min(abs(h[i] - h[j]) + dp[j] for j in range(max(0,i-k),i))
    print(dp[-1])

main()
### BUGGY CODE ###

s = input()
k = int(input())
anstr = ""
for i in range(len(s)):
  anstr += s[i]*(int(s[i])**5000000000000000)
  if len(anstr) > k:
    break
print(anstr[k-1])

### FIXED CODE ###

s = input()
k = int(input())
ans = 1
for i in range(len(s)):
  if s[i] != "1":
    if i <= k-1:
      ans = int(s[i])
      break
print(ans)
### BUGGY CODE ###

import sys
n, m = map(int,sys.stdin.readline().split())
a = list(map(int,sys.stdin.readline().split()))
for k in [0]*m:
  s, t = map(int,sys.stdin.readline().split())
  a.extend([t]*s)
ans = 0
a.sort()
for v in range(n):
  ans += a[-v-1]
print(ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline
n,m = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
b = [list(map(int,input().split())) for p in [0]*m]
b.sort(key=lambda q: -q[1])
#print(a)
#print(b)

c = 0
for s in b:
	for t in [0]*s[0]:
		#print(s)
		if c + 1 > n:
			break
		if s[1] <= a[c]:
			break
		a[c] = s[1]
		c += 1
		#print(a)
	else:
		continue
	break
print(sum(a))
### BUGGY CODE ###

# coding: utf-8


def solve(*args: str) -> str:
    n = int(args[0])
    a = 1

    for m in range(n, 1, -2):
        a *= m

    ret = 0
    for s in reversed(str(a)):
        if s == '0':
            ret += 1
        else:
            break

    return str(ret)


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))


### FIXED CODE ###

# coding: utf-8


def solve(*args: str) -> str:
    n = int(args[0])

    if n % 2 != 0:
        return '0'

    ret = 0
    d = 10
    while d <= n:
        ret += n//d
        d *= 5

    return str(ret)


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))
### BUGGY CODE ###

n = int(input())
a = [0] * n
for i in range(n):
    a[i] = int(input())

for i in range(0, n):
    tmp = a[i]
    a.remove(a[i])
    print(max(a))
    a.insert(i, tmp)

### FIXED CODE ###

n = int(input())
a = [0] * n
for i in range(n):
    a[i] = int(input())

maxa = max(a)
index_max = a.index(maxa)

for i in range(0, n):
    if i == index_max:
        print(sorted(a)[-2])
    else:
        print(maxa)
### BUGGY CODE ###

N=str(input())
l=len(N)

ans=0
for i in range(l):
    for j in range(i+4,l+1):
        if int(N[i:j])%2019==0:
            ans+=1

print(ans)

### FIXED CODE ###

#https://mirucacule.hatenablog.com/entry/2020/04/27/090908
#https://drken1215.hatenablog.com/entry/2020/04/29/171300

S=str(input())[::-1]#逆順で格納
N=len(S)
counter=[0]*2019
counter[0]=1
ans=0
num,d=0,1
for c in S:
    num += int(c) * d
    num %= 2019
    d *= 10
    d %= 2019
    counter[num]+=1
for i in counter:
    ans += i*(i-1)//2
print(ans)
### BUGGY CODE ###

X=int(input())
n=0
while n<10**8:
    A=X+(n**5)
    check=(A**0.2)
    if(check==int(check)):
        AnsA=check
        AnsB=n
        print(str(int(AnsA))+" "+str(int(AnsB)))
        break
    else:
        n=n+1

### FIXED CODE ###

X=int(input())

for A in range(-1000,1000):
    for B in range (-1000,1000):
        if(A**5-B**5==X):
            print(A,B)
            break
    else:
        continue
    break
### BUGGY CODE ###

n,c = map(int, input().split())
x = [0]
xr = [0]
v = []
va = [0]
fa_clock = [0]
fa_reclock = [0]

prev = 0
for i in range(n):
    xi,vi = map(int, input().split())
    x.append(xi)
    xr.append(c - xi)
    v.append(vi)
    va.append(vi + prev)
    fa_clock.append(vi + prev - xi)
    fa_reclock.append(vi + prev - xi*2)
    prev += vi
v.append(0)

maxcal = 0
for ib in range(n+1):
    clock = max(fa_clock[:n+1-ib]) + sum(v[n-ib:]) - 2*xr[-ib]
    reclock = max(fa_reclock[:n+1-ib]) + sum(v[n-ib:]) - xr[-ib]
    ans = max(clock, reclock)
    if maxcal < ans: maxcal = ans
print(maxcal)

### FIXED CODE ###

n,c = map(int, input().split())
x = []
x_r = []
v = []
for i in range(n):
    xi,vi = map(int, input().split())
    x.append(xi)
    x_r.append(c - xi)
    v.append(vi)
x_r.reverse()
x.insert(0, 0)
x_r.insert(0, 0)

score = [0]
score_r = [0]
tmp = 0
for i, vi in enumerate(v):
    tmp += vi
    score.append(tmp - x[i+1])
tmp = 0
for i, vi in enumerate(v[::-1]):
    tmp += vi
    score_r.append(tmp - x_r[i+1])

maxscore = []
maxscore_r = []
tmp = 0
for i, si in enumerate(score):
    tmp = max(tmp, si)
    maxscore.append(tmp)
tmp = 0
for i, si in enumerate(score_r):
    tmp = max(tmp, si)
    maxscore_r.append(tmp)

ans = 0
for i, si in enumerate(score):
    ans = max(si + maxscore_r[n-i] - x[i], ans)
for i, si in enumerate(score_r):
    ans = max(si + maxscore[n-i] - x_r[i], ans)

print(ans)
### BUGGY CODE ###

def main():
    import heapq
    
    def dijkstra(graph,start,cd,MAX,s):
        dist = [[float("inf")]*MAX for _ in range(n)]
        q = []
        
        c,d = cd[start]
        for i in range(MAX):
            if c*i+s < MAX:
                dist[start][c*i+s] = d*i
                heapq.heappush(q, (d*i,start,s+c*i))
            else:
                break
        while q:
            cost, cur_node,coin = heapq.heappop(q)
            
            if dist[cur_node][coin] < cost:
                continue
            
            for nex_node,nex_cost,nex_time  in graph[cur_node]:
                if coin >= nex_cost and dist[nex_node][coin-nex_cost] > cost+nex_time:
                    now_coin = coin - nex_cost
                    now_cost = cost+nex_time
                    c,d = cd[nex_node]
                    for i in range(MAX):
                        if c*i+now_coin < MAX:
                            if dist[nex_node][c*i+now_coin] > d*i+now_cost:
                                dist[nex_node][c*i+now_coin] = d*i+now_cost
                                heapq.heappush(q, (d*i+now_cost,nex_node,now_coin+c*i))
                        else:
                            break
                    
        for i in dist[1:]:
            print(min(i))
    n,m,s = map(int,input().split())
    E = [[] for i in range(n)]
    la = []
    for i in range(m):
        u,v,a,b = map(int,input().split())
        u -= 1
        v-= 1
        la.append(a)
        E[u].append((v,a,b))
        E[v].append((u,a,b))

    cd = [list(map(int,input().split())) for i in range(n)]

    dijkstra(E,0,cd,2501,min(s,2500))
if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    import heapq
    
    def dijkstra(graph,start,cd,s):
        dist = [[float("inf")]*2505 for _ in range(n)]
        q = []
        dist[start][s] = 0
        heapq.heappush(q, (0,start,s))
        
        while q:
            cost, cur_node,coin = heapq.heappop(q)
            
            if dist[cur_node][coin] < cost:
                continue
            
            for nex_node,nex_cost,nex_time  in graph[cur_node]:
                if coin >= nex_cost and dist[nex_node][coin-nex_cost] > cost+nex_time:
                    dist[nex_node][coin-nex_cost] = cost+nex_time
                    heapq.heappush(q, (cost+nex_time,nex_node,coin-nex_cost))
            if dist[cur_node][min(2500,coin+cd[cur_node][0])] > cost+cd[cur_node][1]:
                 dist[cur_node][min(2500,coin+cd[cur_node][0])] = cost+cd[cur_node][1]
                 heapq.heappush(q,(cost+cd[cur_node][1],cur_node,min(2500,coin+cd[cur_node][0])))
                    
        for i in dist[1:]:
            print(min(i))
    n,m,s = map(int,input().split())
    E = [[] for i in range(n)]
    la = []
    for i in range(m):
        u,v,a,b = map(int,input().split())
        u -= 1
        v-= 1
        la.append(a)
        E[u].append((v,a,b))
        E[v].append((u,a,b))

    cd = [list(map(int,input().split())) for i in range(n)]

    dijkstra(E,0,cd,min(s,2500))
if __name__ == "__main__":
    main()
### BUGGY CODE ###

import collections

def Z(): return int(input())
def ZZ(): return [int(_) for _ in input().split()]

def main():
    N = Z()
    A = collections.Counter(ZZ())
    e = collections.defaultdict(list)
    l = [False] * (10 ** 6 + 5)

    def yakusu(num):
        ret = []
        lim = int(num ** 0.5) + 5
        for i in range(1, lim):
            if i * i > num: break
            if num%i != 0: continue
            ret.append(i)
            if i != num//i: ret.append(num//i)
        return ret

    if 1 in A.keys():
        if A[1] == 1: print(1)
        elif A[1] >= 2: print(0)
        return

    ans = 0
    for n in A.keys():
        l[n] = True
        e[n] = yakusu(n)

    for n in A.keys():
        if A[n] >= 2: continue
        if len(e[n]) == 2:
            ans += 1
            continue
        for p in e[n]:
            if p in {1, n}: continue
            if l[p]: break
        else: ans += 1
    print(ans)

    return

if __name__ == '__main__':
    main()


### FIXED CODE ###

import collections

def Z(): return int(input())
def ZZ(): return [int(_) for _ in input().split()]

def main():
    N = Z()
    A = sorted(ZZ())
    cA = collections.Counter(A)
    MAX_A = 10 ** 6
    is_ok = [True] * (MAX_A + 1)

    if 1 in cA.keys():
        if cA[1] == 1: print(1)
        elif cA[1] >= 2: print(0)
        return

    for a in cA.keys():
        if not is_ok[a]: continue
        if cA[a] >= 2: is_ok[a] = False
        for i in range(2, MAX_A + 1):
            if a * i > MAX_A: break
            is_ok[a * i] = False

    ans = 0
    for a in cA.keys():
        if is_ok[a]: ans += 1

    print(ans)

    return

if __name__ == '__main__':
    main()
### BUGGY CODE ###

# coding: utf-8
import sys
import numpy as np

input = sys.stdin.readline

N, Q = map(int, input().split())
S = input().strip()
td_list = [input().split() for _ in range(Q)]

def sim(idx): # i番目のゴーレムの最終結果を得る
  for td in td_list:
    if idx == -1:
      return -1
    elif idx == N:
      return N
    elif td[0] == S[idx]:
      if td[1] == "L":
        idx -= 1
      else:
        idx += 1
  return idx


# 左側の境界を探索
idx = N // 2
lb = 0

while True:
  if idx == N-1: # すべて左に出た
    lb = N-1
    break
  l = sim(idx)
  r = sim(idx+1)
  if l == -1 and r != -1: # 境界がみつかった
    lb = idx
    break
  if l == -1:
    idx = (idx + N) // 2
  else:
    idx = idx // 2

# 右側の境界を探索
idx = N // 2
rb = 0

while True:
  if idx == 0: # すべて右に出た
    rb = 0
    break
  l = sim(idx)
  r = sim(idx+1)
  if l != N and r == N: # 境界が見つかった
    rb = idx
    break
  if l != N:
    idx = (idx + N) // 2 
  else:
    idx = idx // 2

print(rb - lb)

### FIXED CODE ###

# coding: utf-8
import sys

input = sys.stdin.readline

N, Q = map(int, input().split())
S = input().strip()
td_list = [input().split() for _ in range(Q)]
dest = [-2] * (N+1)

def sim(i): # i番目のゴーレムの最終結果を得る
  idx = i
  if dest[i] != -2:
    return dest[i]
  for td in td_list:
    if idx == -1:
      dest[i] = -1
      return -1
    elif idx == N:
      dest[i] = N
      return N
    elif td[0] == S[idx]:
      if td[1] == "L":
        idx -= 1
      else:
        idx += 1
  dest[i] = idx
  return idx


# 左側の境界を探索
left, right = -1, N

while right - left != 1:
  mid = (left + right) // 2
  if sim(mid) == -1:
    left = mid
  else:
    right = mid

lb = right

# 右側の境界を探索
left, right = -1, N

while left+1 < right:
  mid = (left + right) // 2
  if sim(mid) == N:
    right = mid
  else:
    left = mid

rb = left

print(rb - lb + 1)
### BUGGY CODE ###

import sys
def LI(): return([int(x) for x in sys.stdin.readline().split()])
 
def main():
    H,W = LI()
    A = [LI() for _ in range(H)]
    B = [LI() for _ in range(H)]
    D = [[abs(A[h][w]-B[h][w]) for w in range(W)] for h in range(H)]
    dp = [[set() for w in range(W)] for h in range(H)]

    dp[0][0].add(D[0][0]) 

    for h in range(H):
        for w in range(W):
            if(h>0):
                for s in dp[h-1][w]:
                    dp[h][w].add(abs(s-D[h][w]))
                    if s<=6400:
                        dp[h][w].add(s+D[h][w])
            if(w>0):
                for s in dp[h][w-1]:
                    dp[h][w].add(abs(s-D[h][w]))
                    if s<=6400:
                        dp[h][w].add(s+D[h][w])
    return(min(dp[H-1][W-1]))
 
if __name__ == "__main__":
    print(main())



### FIXED CODE ###

import sys
def LI(): return([int(x) for x in sys.stdin.readline().split()])
def main():
    H,W = LI()
    A = [LI() for _ in range(H)]
    B = [LI() for _ in range(H)]
    D = [[abs(A[h][w]-B[h][w]) for w in range(W)] for h in range(H)]
    dp=[[0]*W for _ in range(H)]
    dp[0][0]=1<<D[0][0]<<20000

    for h in range(H):
        for w in range(W):
            if(h>0):
                dp[h][w] |= dp[h-1][w]<<D[h][w]
                dp[h][w] |= dp[h-1][w]>>D[h][w]
            if(w>0):
                dp[h][w] |= dp[h][w-1]<<D[h][w]
                dp[h][w] |= dp[h][w-1]>>D[h][w]
    for i in range(81):
        bit = 1<<(20000+i)
        bit |= 1<<(20000-i)
        if dp[H-1][W-1]&bit:
            return(i)
 
if __name__ == "__main__":
    print(main())
### BUGGY CODE ###

while 1:
    try:
        s1 = raw_input()
        s2 = raw_input()
        l = len(s1)
        f = False
        for i in range(l,0,-1):
            for j in range(0,l-i+1):
                if j+i > l: break
                x = s2.find(s1[j:j+i])
                if x != -1:
                    f = True
                    print i
                    break
            if f: break
        if i == 1 and not f: print 0
    except:
        break

### FIXED CODE ###

while 1:
    try:
        s1 = raw_input()
        s2 = raw_input()
        if len(s1) < len(s2): s1,s2 = s2,s1
        l = sum(min(s1.count(i), s2.count(i)) for i in set(list(s1)) & set(list(s2)))
        if l == 0: print 0; continue
        ans = 0
        for i in range(len(s2)):
            if len(s2) - i <= ans: break
            for j in range(ans+1, min(l + 1,len(s2)-i+1)):
                if s2[i:i+j] in s1:
                    ans = j
                else: break
        print ans
    except:
        break
### BUGGY CODE ###

N, M = map(int, input().split())
YL = [[int(i) for i in input().split()] + [j] for j in range(M)]
SORT = sorted(YL)

for i in range(1,N+1):
    ct = 1
    for j in SORT:
        if j[0] == i:
            j.append('{:0=6}'.format(i))
            j.append('{:0=6}'.format(ct))
            ct += 1
        else:
            continue
SORT.sort(key=lambda x:x[2])
for i in SORT:
    print('%s%s' % (i[3], i[4]))


### FIXED CODE ###

N, M = map(int, input().split())
YL = [[int(i) for i in input().split()] + [j] for j in range(M)]
YL.sort()
ct = 1
for i in range(M):
    if YL[i][0] != YL[i-1][0]:
        ct = 1
    YL[i].append('{:0=6}'.format(YL[i][0]))
    YL[i].append('{:0=6}'.format(ct))
    ct += 1
YL.sort(key=lambda x:x[2])
for i in YL:
    print('%s%s' % (i[3], i[4]))
### BUGGY CODE ###

Mod = 10**9+7
N,M = map(int, input().split())
a = [int(input()) for _ in range(M)]
b = [1]+[0]*N
for i in range(1,N+1):
    if i in a:
        continue
    if i == 1:
        b[1] += b[0]
        continue
    b[i] += b[i-1]+b[i-2]
print(b[N]%Mod)

### FIXED CODE ###

Mod = 10**9+7
N,M = map(int, input().split())
a = [int(input()) for _ in range(M)]
b = [1]*(N+1)
for j in a:
    b[j] = 0
for i in range(1,N+1):
    if b[i] == 0:
        continue
    if i == 1:
        b[1] = 1
        continue
    b[i] = b[i-1]+b[i-2]
    if b[i] >= Mod:
        b[i] %= Mod
print(b[N])
### BUGGY CODE ###

import itertools
n = int(input())
s = [i for i in input()]
p = set()
for v in itertools.combinations(s, 3):
    p.add(v[0]+v[1]+v[2])
print(len(p))

### FIXED CODE ###

n = int(input())
s = input()
ans = 0
for i in range(10):
    a = s.find(str(i))
    if a == -1: continue
    for j in range(10):
        b = s.find(str(j), a+1)
        if b == -1: continue
        for k in range(10):
            if s.find(str(k), b+1) != -1:
                ans += 1
print(ans)