Harryxun/stf_run huggingface dataset:
from functools import gcd
from math import sqrt
A, B = map(int, input().split())

n = gcd(A, B)

ans = set()
for i in range(2, int(sqrt(n)+1)+1):
    while n % i == 0:
        n = n // i
        ans.add(i)

print(len(ans)+1)




### FIXED CODE ###

from fractions import gcd
from math import sqrt
A, B = map(int, input().split())

n = gcd(A, B)

ans = set()
for i in range(2, int(sqrt(n)+1)+1):
    while n % i == 0:
        n = n // i
        ans.add(i)
if n > 1:
    ans.add(n)

print(len(ans)+1)
S, T = map(input().split())
A, B = map(int, input().split())
U = input()

print(A-1 B if U == S else A B-1)


### FIXED CODE ###

S, T = input().split()
A, B = map(int, input().split())
U = input()

print(A-1, B) if U == S else print(A, B-1)
n = int(input())
counters = {}
from collections import Counter
for i in range(n):
  s = input()
  c = Counter(s)
  if c not in counters: counters[c] = 1
  else: counters[c] += 1
a = counters.values()
ans = 0
for i in range(len(a)):
  ans += a[i]*(a[i]-1)/2
print(ans)


### FIXED CODE ###

n = int(input())
dic = {}
for i in range(n):
  s = input()
  s = sorted(s)
  s = ''.join(s)
  if s not in dic:
    dic[s] = 1
  else:
    dic[s] += 1

ans = 0
for _ in dic:
  if dic[_]>1: ans = ans + int(dic[_]*(dic[_]-1)/2)
    
print(ans)
A, B, C, D = map(int,input().split())

if A <= B:
    train = A
else:
    train = B
if C <= D:
    bus = C
else:
    bus = D

print(train + bus)

### FIXED CODE ###

A = int(input())
B = int(input())
C = int(input())
D = int(input())

if A <= B:
    train = A
else:
    train = B
if C <= D:
    bus = C
else:
    bus = D

answer = (train + bus)
print(answer)
import math.fact
N, K = map(int, input().split())

def combination_mod(n, r, mod):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n-r)
    return fact[n] * factinv[r] * factinv[n-r] % mod

mod = 10**9+7
fact = [1, 1]
factinv = [0, 1]
inv = [0, 1]
total = 0

for i in range(2, N+1):
    fact.append((fact[-1] * i) % mod)
    inv.append((-inv[mod % i] * (mod // i)) % mod)
    factinv.append((factinv[-1] * inv[-1]) % mod)

for i in range(K, N+1):
    total += combination_mod(N, i, mod) % mod

print(total)


### FIXED CODE ###

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

total = 0
mod = 10**9+7
s = [0]
for i in range(0, N+1):
    s.append(s[-1] + i)

for i in range(K, N+2):
    total = (total + ((s[-1]-s[-(i+1)]) - s[i] + 1)) % mod
print(total)
K = int(input())
N = int(input())
A = [int(input()) for i in range(N)]

D = []
for i in range(N):
	D.append((K + A[i] - A[i - 1]) % K)
    
print(K - max(D))

### FIXED CODE ###

# K = int(input())
# N = int(input())
# A = [int(input()) for i in range(N)]
K, N = list(map(int,input().split()))
A = list(map(int,input().split()))
 
D = []
for i in range(N):
	D.append((K + A[i] - A[i - 1]) % K)
    
print(K - max(D))
N = float(input())
x = N/1.08
x = int(x)
print(x)


### FIXED CODE ###

a,b = map(int, input().split())
m,n = map(int, input().split())
c=0
d=1

if a==m:
 print(c)
else: 
 print(d)
import numpy as np
a = int(input())
c = np.zeros(a)
for i in range(7):
	if(i == 3 or i == 6):
		c[i] = 1
#print(c)
for i in range(7, 40):
	if(c[i-4] == 1 or c[i-7] == 1):
		c[i] = 1
if(c[-1] == 1):
	print("Yes")
else:
	print("No")

### FIXED CODE ###

import numpy as np
a = int(input())
if(a > 7):
	c = np.zeros(a)
	for i in range(7):
		if(i == 3 or i == 6):
			c[i] = 1
	#print(c)
	for i in range(7, c.shape[0]):
		if(c[i-4] == 1 or c[i-7] == 1):
			c[i] = 1
	if(c[-1] == 1):
		print("Yes")
	else:
		print("No")
else:
	if(a == 4 or a == 7):
		print("Yes")
	else:
		print("No")
n = raw_input()
a = map(int, raw_input().split())
 
for i in range(0, n):
   print A(n-i),

### FIXED CODE ###

n = input()
a = map(int, raw_input().split())
    
for i in range(0, n):
   print a[n-i-1],
import sys
input = sys.stdin.readline
import heapq
from collections import deque

N = int(input())
X = [[] for _ in range(N)]
for i in range(N-1):
  a = int(input())
  X[a-1].append(i+1)
  
# dfsをして、Depthを計算しつつ、depth大きい順に取り出せるようにheapqを使う
h = []

seen = [False] * N
def dfs(a,depth):
  seen[a] = True
  heapq.heappush(h, (-depth, a))
  for nxt in X[a]:
    #if seen[nxt]:
      #continue
    dfs(nxt, depth+1)

dfs(0,0)
#rint(len(h))
DP = [0] * N
while h:
  depth, a = heapq.heappop(h)
  cand = []
  for child in X[a]:
    cand.append(DP[child])
  if not cand:
    DP[a] = 1
    continue
  cand.sort(reverse=True)
  for i in range(len(cand)):
    DP[a] = max(DP[a], cand[i]+i+1)
    
print(DP[0]-1)

### FIXED CODE ###

import sys
input = sys.stdin.readline
import heapq
from collections import deque
sys.setrecursionlimit(200000)

N = int(input())
X = [[] for _ in range(N)]
for i in range(N-1):
  a = int(input())
  X[a-1].append(i+1)
  
# dfsをして、Depthを計算しつつ、depth大きい順に取り出せるようにheapqを使う
h = []

seen = [False] * N
def dfs(a,depth):
  seen[a] = True
  heapq.heappush(h, (-depth, a))
  for nxt in X[a]:
    #if seen[nxt]:
      #continue
    dfs(nxt, depth+1)

dfs(0,0)
#rint(len(h))
DP = [0] * N
while h:
  depth, a = heapq.heappop(h)
  cand = []
  for child in X[a]:
    cand.append(DP[child])
  if not cand:
    DP[a] = 1
    continue
  cand.sort(reverse=True)
  for i in range(len(cand)):
    DP[a] = max(DP[a], cand[i]+i+1)
    
print(DP[0]-1)
import sys
sys.setrecursionlimit(10**6)

N, M = map(int, input().split())
G = [[] for i in range(N)]
for i in range(M):
    a, b = map(int, input().split())
    G[a-1].append(b-1)
    G[b-1].append(a-1)

used = [0]*N
Q1 = []
Q2 = []
def dfs(v, Q):
    if used[v]:
        return 0
    used[v] = 1
    Q.append(v+1)
    for w in G[v]:
        if dfs(w, Q):
            return 1
    return 1

if len(G[0]) == 1:
    dfs(0, Q1)
    print(len(Q1))
    print(*Q1)
else:
    used[0] = 1
    for v in G[0]:
        if dfs(v, Q1):
            break
    for v in G[0]:
        if dfs(v, Q2):
            break
    print(len(Q1) + len(Q2) + 1)
    print(*Q1[::-1], 1, *Q2)


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)

N, M = map(int, input().split())
G = [[] for i in range(N)]
for i in range(M):
    a, b = map(int, input().split())
    G[a-1].append(b-1)
    G[b-1].append(a-1)

used = [0]*N
Q1 = []
Q2 = []
def dfs(v, Q):
    if used[v]:
        return 0
    used[v] = 1
    Q.append(v+1)
    for w in G[v]:
        if dfs(w, Q):
            return 1
    return 1

if len(G[0]) == 1:
    dfs(0, Q1)
    print(len(Q1))
    print(*Q1)
else:
    used[0] = 1
    for v in G[0]:
        if dfs(v, Q1):
            break
    for v in G[0]:
        if dfs(v, Q2):
            break
    print(len(Q1) + len(Q2) + 1)
    print(*(Q1[::-1]+[1]+Q2))
lis = list(map(int, input().split()))
lis2 = list(map(int, input().split()))
n = lis[0]
k = lis[1]
a = []
b = []
for i in range(n):
    if lis2[i] not in a:
        a.append(lis2[i])
        count = 0
        for j in range(i+1,n):
            if lis2[j] == lis2[i]:
                count += 1
        b.append(count)

if len(b) <= k:
    print(0)
else:
    b.sort()
    b.reserve()
    swap = 0
    for i in range(k,len(b)):
        swap += b[i]
    print(swap)

### FIXED CODE ###

lis = list(map(int, input().split()))
lis2 = input().split()
n = lis[0]
k = lis[1]
d = {}

for i in range(n):
    if lis2[i] not in d.keys():
       d[lis2[i]] = 1
    else:
        d[lis2[i]] += 1 
        
if len(list(d.values())) <= k:
    print(0)
else:
    a = list(d.values())
    a.sort()
    a.reverse()
    swap = 0
    for i in range(k,len(a)):
        swap += a[i]
    print(swap)
N, Y = list(map(int, input().split()))

# Flag = False
final_ans = None
for i in range(N + 1):
    for j in range(N + 1 - i):
        ans = i * 10000 + j * 5000 + (N - i - j) * 1000
        if ans == Y:
            final_ans = f"{i} {j} {N - i - j}"
            break

if final_ans is None:
    print('-1 -1 -1')
else:
    print(final_ans)


### FIXED CODE ###

N, Y = list(map(int, input().split()))
final_ans = None
for i in range(N + 1):
    for j in range(N + 1):
        if i + j > N:
            continue
        ans = i * 10000 + j * 5000 + (N - i - j) * 1000
        if ans == Y:
            final_ans = " ".join([str(i), str(j), str(N - i - j)])
            break

if final_ans is None:
    print('-1 -1 -1')
else:
    print(final_ans)
x = input().split()
A = input().split()
H = int(x[0])
N = int(x[1])
a = 0
for i in range(N):
    a+=(A[i])
if a>=H:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

x = input().split()
A = input().split()
H = int(x[0])
N = int(x[1])
a = 0
for i in range(N):
    a+=int(A[i])
if a>=H:
    print("Yes")
else:
    print("No")
N=int(input())
A=list(map(int,input().split()))
temp=1
summ=0
cont=0
templist=[1]
for i in range(N+1):
  #print(temp)
  if A[i]<temp:
    if i<N:
      summ+=temp
      temp=2*(temp-A[i])
      templist.append(temp)
    if i==N:
      summ+=temp
      cont+=1
  elif A[i]==temp:
    if i==N:
      summ+=temp
      #templist.append(temp)
      cont+=1
    else:
      print("-1")
      break
  else:
    print("-1")
    break
    
if cont==1:
  #if A[N]==temp:
  #  print(summ)
  #else:
  #print(templist)
  #print(A)
  comp=A[-1]
  for i in range(N+1):
    summ-=(templist[-(i+1)]-comp)
    comp+=A[-(i+2)]
    #print(comp)
    #print(templist[-(i+2)])
    #print(summ)
    if comp>templist[-(i+2)]:
      print(summ)
      break


### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
temp=1
summ=0
cont=0
templist=[1]
for i in range(N+1):
  #print(temp)
  if A[i]<temp:
    if i<N:
      summ+=temp
      temp=2*(temp-A[i])
      templist.append(temp)
    elif i==N:
      summ+=temp
      cont+=1
  elif A[i]==temp:
    if i==N:
      summ+=temp
      #templist.append(temp)
      cont+=1
    else:
      print("-1")
      break
  else:
    print("-1")
    break
    
if cont==1:
  if A[N]==temp:
  	print(summ)
  else:
    #print(templist)
    #print(A)
    comp=A[-1]
    for i in range(N):
      summ-=(templist[-(i+1)]-comp)
      comp+=A[-(i+2)]
      #print(comp)
      #print(templist[-(i+2)])
      #print(summ)
      if comp>templist[-(i+2)]:
        print(summ)
        break
      if i==N-1:
        print(summ)
        break
n = input()

color = [0 for i in range(n)]
d = [0 for i in range(n)]
f = [0 for i in range(n)]
M = [0 for i in range(n)] for j in range(n)]
t = 0

def dfs_v(u):
  color[u] = 1
  t += 1
  d[u] = t
  for v in range(n):
    if M[u][v] == 1 and color[v] == 0:
      dfs_v(v)
  color[u] = 2
  t += 1
  f[u] = t

def dfs():
  for u in range(n):
    if color[u] == 0:
      dfs_v(u)
  for u in range(n):
    print u+1, d[u], f[u]

for i in range(n):
  X = map(int, raw_input().split())
  for j in range(X[1]):
    M[X[0]-1] [X[2+j]-1] = 1

dfs()
    

### FIXED CODE ###

n = int(raw_input())
 
d = [0 for i in range(n)]
f = [0 for i in range(n)]
G = [0 for i in range(n)]
M = [[0 for i in range(n)] for j in range(n)]
col = [0 for i in range(n)]
t = [0]
 
def DFS_visit(u):
    col[u] = 1
    t[0] += 1
    d[u] = t[0]
    for v in range(n):
        if M[u][v] == 1 and col[v] == 0:
            DFS_visit(v)
    col[u] = 2
    t[0] += 1
    f[u] = t[0]
 
def DFS():
    for u in range(n):
        if col[u] == 0:
            DFS_visit(u)
    for u in range(n):
        print'{0} {1} {2}'.format(u+1, d[u], f[u])
     
for i in range(n):
    X = map(int, raw_input().split())
    for j in range(X[1]):
        M[X[0]-1][X[2+j]-1] = 1
 
DFS()
# ABC072
# C
# Together
import itertools

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

a.sort()
gr = itertools.groupby(a)
hoge_list = [0]*10001
ans = 0

for key, group in gr:
    hoge_list[key] = len(list(group))

for i in range(1000):
    _tmp = hoge_list[i-1] + hoge_list[i] + hoge_list[i+1]
    if ans < _tmp:
        ans = _tmp

print(ans)
    

### FIXED CODE ###

# ABC072
# C
# Together
import itertools

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

a.sort()
gr = itertools.groupby(a)
hoge_list = [0]*100001
ans = 0

for key, group in gr:
    hoge_list[key] = len(list(group))

for i in range(1,100000,1):
    _tmp = hoge_list[i-1] + hoge_list[i] + hoge_list[i+1]
    if ans < _tmp:
        ans = _tmp

print(ans)
# https://qiita.com/_-_-_-_-_/items/34f933adc7be875e61d0
# abcde	s=input()	s='abcde'
# abcde	s=list(input())	s=['a', 'b', 'c', 'd', 'e']
# 5(1つだけ)	a=int(input())	a=5
# 1 2	| x,y = map(int,input().split())   |	x=1,y=2
# 1 2 3 4 5 ... n 　	li = input().split()	li=['1','2','3',...,'n']
# 1 2 3 4 5 ... n 　	li = list(map(int,input().split()))	li=[1,2,3,4,5,...,n]
# FFFTFTTFF 　	li = input().split('T')	li=['FFF', 'F', '', 'FF']

# INPUT
# 3
# hoge
# foo
# bar
# ANSWER
# n=int(input())
# string_list=[input() for i in range(n)]


from collections import defaultdict, Counter
import math
from bisect import bisect_left, bisect_right
import numpy as np

s = input()
t = input()

for i in range(0, len(s)-len(t)+1):
    s_s = s[i:len(s)-1+i]
    flag = True
    for ssi, ti in zip(s_s, t):
        if ssi == "?":
            continue
        if ssi != ti:
            flag = False
            break
    if flag:
        ans_i = i
        break

if flag:
    print((s[0:ans_i]+t+s[len(s)+ans_i:]).replace("?", "a"))
else:
    print("UNRESTORABLE")

### FIXED CODE ###

# https://qiita.com/_-_-_-_-_/items/34f933adc7be875e61d0
# abcde	s=input()	s='abcde'
# abcde	s=list(input())	s=['a', 'b', 'c', 'd', 'e']
# 5(1つだけ)	a=int(input())	a=5
# 1 2	| x,y = map(int,input().split())   |	x=1,y=2
# 1 2 3 4 5 ... n 　	li = input().split()	li=['1','2','3',...,'n']
# 1 2 3 4 5 ... n 　	li = list(map(int,input().split()))	li=[1,2,3,4,5,...,n]
# FFFTFTTFF 　	li = input().split('T')	li=['FFF', 'F', '', 'FF']

# INPUT
# 3
# hoge
# foo
# bar
# ANSWER
# n=int(input())
# string_list=[input() for i in range(n)]


from collections import defaultdict, Counter
import math
from bisect import bisect_left, bisect_right
import numpy as np

s = input()
t = input()

if len(s) >= len(t):
    ans_l = []
    for i in range(0, len(s)-len(t)+1):
        s_s = s[i:len(s)-1+i]
        flag = True
        for ssi, ti in zip(s_s, t):
            if ssi == "?":
                continue
            if ssi != ti:
                flag = False
                break
        if flag:
            ans_l.append(i)

    d = []
    for ans_i in ans_l:
        tmp_s = (s[:ans_i]+t+s[len(t)+ans_i:]).replace("?", "a")
        d.append(tmp_s)
    d = sorted(d)
    if len(d) > 0:
        print(d[0])
    else:
        print("UNRESTORABLE")
else:
    print("UNRESTORABLE")
N, M = map(int , input().split())
if N == 1 and M == 1:
    print(1)
elif N == 1 and M == 2:
    print(0)
elif N == 2 and M == 1:
    print(0)
elif N == 1 or M == 1:
    print(NM - 2)
else:
    print((N-2) * (M-2))

### FIXED CODE ###

N, M = map(int , input().split())
if N == 1 and M == 1:
    print(1)
elif N == 1 and M == 2:
    print(0)
elif N == 2 and M == 1:
    print(0)
elif N == 1 or M == 1:
    print(N*M - 2)
else:
    print((N-2) * (M-2))
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

from sympy import divisors
N = int(input())
ans = len(divisors(N-1))-1
lis = divisors(N)
for n in lis:
    G = N
    if n==1:
        continue
    while G%n==0:
        G //= n
    if G%n==1:
        ans += 1
print(ans)

### FIXED CODE ###

from math import sqrt
N = int(input())
ans = 0
divisors = []

for i in range(2, int(sqrt(N))+1):
    if N%i==0:
        divisors.append(i)
        divisors.append(N//i)

for d in set(divisors):
    i = 1
    while N%(d**i)==0:
        i += 1
    n = N//(d**(i-1))
    if n%d==1:
        ans+=1

for i in range(2, int(sqrt(N))+1):
    if (N-1)%i==0:
        if i**2!=N-1:
            ans += 2
        else:
            ans += 1
if N==2:
    print(1)
else:
    print(ans+2)
a = int(input())
b = []
c = []
ans = ""

for i in range(a):
    b.append(input())
    c.append(len(b[i]))

print(b[1])
print(min(c))

alpha = [chr(i) for i in range(97,97+26)]
print(alpha)

if min(c) >= a:
    for ii in range(26):
        d = []
        for i in range(a):
            d.append(b[i].count(alpha[ii]))
        ans = ans + (alpha[ii] * min(d))
        if len(ans) > a:
            break

if len(ans) < a:
    ans = ""
else:
    ans[0:a-1]
            
print(ans)

### FIXED CODE ###


a = int(input())
b = []
c = []
ans = ""

for i in range(a):
    b.append(input())
    c.append(len(b[i]))

alpha = [chr(i) for i in range(97,97+26)]

for ii in range(26):
    d = []
    for i in range(a):
        d.append(b[i].count(alpha[ii]))
    ans = ans + (alpha[ii] * min(d))
           
print(ans)
n,m=int(input.split())
s=0
for i in input.split():
  s=s+i
if s>n:
  print("-1")
else:
  print(n-s)



### FIXED CODE ###

n,m=map(int, input().split())
s=0
for i in input().split():
    s=s+int(i)
if s>n:
    print("-1")
else:
    print(n-s)
a = list(int(input()) for _  in range(5))
k = int(input())
ans='Yay!'
for i in a:
  for j in len(a):
    if a[j] - i >18:
      ans = ':('
print(ans)

### FIXED CODE ###

a = list(int(input()) for _  in range(5))
k = int(input())
ans='Yay!'
for i in a:
  for j in range(len(a)):
    if a[j] - i >k:
      ans = ':('
print(ans)
X,Y,Z=map(int,input())
print(str(Z)+' '+str(X)+' '+str(Y))

### FIXED CODE ###

X,Y,Z=map(int,input().split())

print(str(Z)+' '+str(X)+' '+str(Y))
import sys
import math
from collections import Counter
import itertools
import fractions
from decimal import Decimal
#from functools import reduce

# 入力を整数に変換して受け取る
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
# 入力全てを整数に変換したものの配列を受け取る
def LI(): return list(map(int, sys.stdin.readline().split()))
# 入力全てを整数に変換して1引いたものの配列を受け取る
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SR(): return sys.stdin.readline().rstrip()

ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ascii_uppercase2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'

# リストを改行区切りで出力する
p2D = lambda x: print(*x, sep="\n")
p2E = lambda x: print(''.join(x))
p2S = lambda x: print(*x, sep=" ")

# ###########################################

kakuM = M*6
kakuH = H*30+0.5*M
 
kakudo = kakuH - kakuM

ans = A**2 + B**2 - 2 * A * B * math.cos(math.radians(kakudo))
 
print(math.sqrt(ans))


### FIXED CODE ###

import sys
import math
from collections import Counter
import itertools
import fractions
from decimal import Decimal
#from functools import reduce

# 入力を整数に変換して受け取る
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
# 入力全てを整数に変換したものの配列を受け取る
def LI(): return list(map(int, sys.stdin.readline().split()))
# 入力全てを整数に変換して1引いたものの配列を受け取る
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SR(): return sys.stdin.readline().rstrip()

ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ascii_uppercase2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'

# リストを改行区切りで出力する
p2D = lambda x: print(*x, sep="\n")
p2E = lambda x: print(''.join(x))
p2S = lambda x: print(*x, sep=" ")

# ###########################################

A,B,H,M=MI()



kakuM = M*6
kakuH = (H+M/60)*30 - kakuM


ans = A**2 + B**2 - 2 * A * B * math.cos(math.radians(kakuH))

print(Decimal(ans).sqrt())
N=input()
a=ACGT
j=0
for i in range(4):
  if a[i]==N:
  	j=i  
print(a[3-j])

### FIXED CODE ###

N=input()
a="ACGT"
j=0
for i in range(4):
  if a[i]==N:
  	j=i  
print(a[3-j])
n=int(input())
h=list(map(int,input().split()))
cnt=0
for i in range(n-1):
  if h[i+1]<h[i]:
    cnt=1
if cnt==1:
  if min(h)=<max(h)=<1+min(h):
    print('Yes')
  else:
    print('No')
else:
  print('Yes')


### FIXED CODE ###

n=int(input())
h=list(map(int,input().split()))
for i in range(1,n):
  if h[-i]+1==h[-i-1]:
    h[-i-1]-=1
  elif h[-i]+1<h[-i-1]:
    print('No')
    exit()
print('Yes')
s, n = input().split()
print(s.count('ABC'))

### FIXED CODE ###

N = int(input())
S = str(input())
print(S.count("ABC"))
list = [int(input()) for i in range(5)]
t = 0
cnt_l = []
for i in range(5):
    cnt = 0
    while list[i] % 10 != 0:
        list[i] += 1
        cnt += 1
    t += list[i]
    if cnt != 0:
        cnt_l.append(cnt)
if not cnt:
    cnt.append(0)
print(t - max(cnt_l))


### FIXED CODE ###

i = [int(input()) for i in range(5)]
i2 = [i2 for i2 in i if i2%10 != 0]

if not i2:
    min = i[len(i)-1]

else:
    min = i2[len(i2)-1]

count = 0
for x in i:
    if 0 < x % 10 < min % 10:
        min = x
        count += 1
i.remove(min)

for x in i:
    if x % 10 != 0:
        index = i.index(x)
        x += 10 - x % 10
        i[index] = x

i.append(min)

print(sum(i))
print(www)

### FIXED CODE ###

a=int(input())
b=(a)//2+1
ans=0
for i in range(1,b,1):
  x=a//i
  ans+=((x**2+x)//2)*i
ans+=(a**2+a+b-b**2)//2
print(ans)
n, k = map(int, input().split())
a = [0] * n
b = [0] * n
sum = 0
arr = []
for i in range(n):
    a[i], b[i] = map(int, input().split())
arr_list = list(zip(a, b))
arr_list = sorted(arr_list)
# print(arr_list)
for i in range(n):
    sum += arr_list[i][1]
    # print(sum, arr_list[i])
    if sum >= k:
        answer = arr_list[i]
        break

print(answer)


### FIXED CODE ###

n, k = map(int, input().split())
a = [0] * n
b = [0] * n
sum = 0
arr = []
for i in range(n):
    a[i], b[i] = map(int, input().split())
arr_list = list(zip(a, b))
arr_list = sorted(arr_list)
# print(arr_list)
for i in range(n):
    sum += arr_list[i][1]
    # print(sum, arr_list[i])
    if sum >= k:
        answer = arr_list[i][0]
        break

print(answer)
n, m = map(int, input().split())
disk, idx = list(range(n + 1)), list(range(n + 1))

now = 0
for _ in range(m):
    nxt = int(input())
    disk[idx[nxt]], idx[nxt], idx[now] = now, 0, idx[nxt]
    now = nxt
print(*disk[1:], sep="\n")

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
ans = [0 for i in range(n+1)]
for i in range(n):
    ans[a[i]] = i + 1
print(*ans[1:])
N=int(input())

V=list(map(int,input().split()))
C=list(map(int,input().split()))

ans=0
for i in range(N):
	if(V[i]-C[i]>0):
		ans+=V[i]-C[i]
print(ans)


### FIXED CODE ###

A,B,T=map(int,input().split())

print(B*(T//A))
import sys
input = sys.stdin.readline
# int(input()) # 入力が1つ
x, y, a, b, c = map(int, input().split()) # 入力が複数

reds = sorted([int(i) for i in input().split()], reverse=True)
greens = sorted([int(i) for i in input().split()], reverse=True)
whites = sorted([int(i) for i in input().split()], reverse=True)

reds = reds[:x] + [-float('inf')]
greens = greens[:y] + [-float('inf')]
whites.append(-float('inf'))

ans = 0
num = 0
r = g = w = 0
while num != x + y:
    red = reds[r]
    green = greens[g]
    white = whites[w]
    if red > green and red > white:
        r += 1
        ans += red
    elif green > red and green > white:
        g += 1
        ans += green
    else:
        w += 1
        ans += white
    num += 1
print(ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline
# int(input()) # 入力が1つ
x, y, a, b, c = map(int, input().split()) # 入力が複数

reds = sorted([int(i) for i in input().split()], reverse=True)
greens = sorted([int(i) for i in input().split()], reverse=True)
whites = sorted([int(i) for i in input().split()], reverse=True)

reds = reds[:x]
greens = greens[:y]

apples = sorted(reds + greens + whites, reverse=True)
ans = sum(apples[:x + y])
print(ans)
import re
# 盤面の状態
s = input()

cnt = 0

while True:
    print(s)
    
    # 全部Wになるまで or 1文字残しまで繰り返す
    if s.count("W") == len(s):
        break

    # Bがどちらにあるか調べる
    if s[0] != "B":
        # 逆向きにする
        s = s[::-1]
        
    # 先頭を置換する
    if s[0] == "B":
        s = re.sub(r'[B]+', "", s,1)
        cnt +=1
    elif s[0] == "W":
        s = re.sub(r'[W]+', "", s,1)
        cnt +=1

print(cnt)

### FIXED CODE ###

import re
# 盤面の状態
s = input()

# Aマッチする数を数える
w = re.findall(r'[W]+', s)
# Bにマッチする数を数える
b= re.findall(r'[B]+', s)

# 全部Wなら入れ替える必要なし
if s.count("W") == len(s):
    print(0)
else:
    print(len(w)+len(b)-1)
while True:
    H, W = [int(i) for i in input().split()]

        if H + W % == 0:
            print('#')
        else:
            print('.')

    print

        

### FIXED CODE ###

while True:
    H, W = [int(i) for i in input().split()]
    if H == W == 0:
       break

    for h in range(H):
        for w in range(W):
            if (h + w) % 2 == 0:
                print('#', end='')
            else:
                print('.', end='')

        print()
    print()