Harryxun/stf_run huggingface dataset:
bt = input()
bt_A, bt_B = bt.split()
bt_max, bt_min = max(bt_A, bt_B), min(bt_A, bt_B)
max_num = bt_max + max(bt_max - 1, bt_min)
print(max_num)

### FIXED CODE ###

bt = input()
bt_A, bt_B = bt.split()
bt_max, bt_min = max(int(bt_A), int(bt_B)), min(int(bt_A), int(bt_B))
max_num = bt_max + max(bt_max - 1, bt_min)
print(max_num)
s = input()
R_num = s.count("R")
print(s[:R_num].count("W")


### FIXED CODE ###

s = input()
s = input()

R_num = s.count("R")
print(s[:R_num].count("W"))
n = int(input())
h = list(map(int, input().split()))

dp = []
for i in range(n):
	dp.append(int(0))
dp[0] = 0
dp[1] = abs(h[0]-h[1])
 
for j in range(2,n):
	dp[j] = min(flog(j-1) + abs(h[j-1] - h[j]),flog(j-2) + abs(h[j-2] - h[j]))
  
print(dp[n-1])

### FIXED CODE ###

n = int(input())
h = list(map(int, input().split()))
 
dp = []
for i in range(n):
	dp.append(int(0))
dp[0] = 0
dp[1] = abs(h[0]-h[1])
 
for j in range(2,n):
	dp[j] = min(dp[j-1] + abs(h[j-1] - h[j]),dp[j-2] + abs(h[j-2] - h[j]))
  
print(dp[n-1])
n=int(input())
arr=list(map(int,input().split()))
if n < 2:
  print(0)
vis={}
vis[0] = 0
vis[1] = 0
if n > 1:
  vis[2] = abs(arr[0]-arr[1])
if n == 2:
  print(vis[2])
for i in range(2, n+1):
    step_1 = abs(arr[i]-arr[i-1]) + vis[i]
    step_2 = abs(arr[i]-arr[i-2]) + vis[i-1]
    vis[i+1] = min(step_1, step_2)
   
print(vis[i+1])

### FIXED CODE ###

n=int(input())
arr=list(map(int,input().split()))
if n < 2:
  print(0)
vis = [0] * n
vis[0] = 0
vis[1] = abs(arr[0]-arr[1])
for i in range(2, n):
    step_1 = abs(arr[i]-arr[i-1]) + vis[i-1]
    step_2 = abs(arr[i]-arr[i-2]) + vis[i-2]
    vis[i] = min(step_1, step_2)
print(vis[-1])
import sys
p=0
n=int(input())
xyh=[[] for i in range(n)]
for i in range(n):
    x,y,h=map(int,input().split())
    xyh[i].append(x)
    xyh[i].append(y)
    xyh[i].append(h)
for i in range(101):
    for j in range(101):
        f=0
        dis=[[i] for i in range(205)]
        for q in range(n):
            x=xyh[q][0]
            y=xyh[q][1]
            h=xyh[q][2]
            d=abs(x-i)+abs(y-j)
            if len(dis[d])==1:
                dis[d].append(h)
            elif dis[d][1]!=h:
                f=1
        
        dis=[dis[e] for e in range(205) if len(dis[e])!=1]
        m=len(dis)
        if m==1 and f==0:
            print(i,j,dis[0][0]+dis[0][1])
            p+=1
        else:
            if all(dis[e][0]+dis[e][1]==dis[e+1][0]+dis[e+1][1] for e in range(m-1)) and f==0:
                print(i,j,dis[0][0]+dis[0][1])
                P+=1
if p>=2:
    print(l)
        
        
        
          


### FIXED CODE ###

import sys

n=int(input())
xyh=[[] for i in range(n)]
for i in range(n):
    x,y,h=map(int,input().split())
    xyh[i].append(x)
    xyh[i].append(y)
    xyh[i].append(h)
for i in range(101):
    for j in range(101):
        f=0
        dis=[[i] for i in range(205)]
        for q in range(n):
            x=xyh[q][0]
            y=xyh[q][1]
            h=xyh[q][2]
            d=abs(x-i)+abs(y-j)
            
            if len(dis[d])==1:
                dis[d].append(h)
            elif len(dis[d])!=1 and dis[d][1]!=h:
                f=1
        
        dis=[dis[e] for e in range(205) if len(dis[e])!=1]
        m=len(dis)
        if m==1 and f==0:
            print(i,j,dis[0][0]+dis[0][1])
            sys.exit()
            
        else:
            if all(dis[e][0]+dis[e][1]==dis[e+1][0]+dis[e+1][1] for e in range(m-1) if dis[e+1][1]!=0) and f==0:
                print(i,j,dis[0][0]+dis[0][1])
                sys.exit()
N = int(input())
S = list(input())

@tail_recursive
def fun(list,c=0):
    if len(list) == 1:
        return c+1
    if list[0] == list[1]:
        return fun(list[1:],c)
    else:
        return fun(list[1:],c+1)

print(fun(S))

### FIXED CODE ###

N = int(input());S = list(input());print(len([(x,i) for i,x in enumerate(S) if i != N-1 if x != S[i+1]])+1)
N,D = map(int,input().split())
l = []
for i in range (N):
    x,y = map(int,input().split())
    l.append(x*x+y*y)
    
ans = 0
for i in range(N):
    if l[i] < D*D:
        cnt += 1

print(cnt)

### FIXED CODE ###

N,D = map(int,input().split())
l = []
for i in range (N):
    x,y = map(int,input().split())
    l.append(x*x+y*y)
    
ans = 0
for i in range(N):
    if l[i] <= D*D:
        ans += 1

print(ans)
n, x = map(int, input().split())

def abs2(m):
    m = int(m)
    return abs(m-x)

import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

xs = list(map(abs2, input().split()))

if n == 1:
    ans = xs[0]
else:
    ans = gcd(*xs)

print(ans)


### FIXED CODE ###

from fractions import gcd
n,x=map(int,input().split())
 
xlist=list(map(int,input().split()))
 
ans=abs(x-xlist[0])
for i in xlist:
    ans=gcd(ans,abs(x-i))
 
print(ans)
N = input()

res = {i+1: 0 for i in range(N)}

for i in range(int(sqrt(N))):
  for j in range(int(sqrt(N))):
    for k in range(int(sqrt(N))):
      res[i**2 + j**2 + k**2 + i*j + j*k + k*i] += 1
print(res)

### FIXED CODE ###

N = int(input())
 
res = {i+1: 0 for i in range(N)}
 
for i in range(1, int(N**0.5)):
  for j in range(1, int(N**0.5)):
    for k in range(1, int(N**0.5)):
      n = i**2 + j**2 + k**2 + i*j + j*k + k*i
      if n in res:
        res[n] += 1
for r in res.values():
  print(r)
K = int(input())
A,B = [int(j) for j in input().split()]
flag=0
for j in range(1,1001):
    if(jK>=A and jK<=B):
        print("OK")
        flag=1
        break
if (flag==0):
    print("NG")

### FIXED CODE ###

K = int(input())
A,B = [int(i) for i in input().split()]
flag=0
for i in range(1,1001):
    if(i*K>=A and i*K<=B):
        print("OK")
        flag=1
        break
if (flag==0):
    print("NG")
A, B, K = map(int, input().split())
t = list(range(A, B+1))
if K > len(t):
    K = len(t)
ans = set()
for i in range(K):
    ans.add(t[i])
    ans.add(t[-(i+1)])
ans2 = list(ans)
ans2.sort()
for a in ans2:
    print(a)

### FIXED CODE ###

A, B, K = map(int, input().split())
if K > B-A+1:
    K = B-A+1
t = set()
for i in range(A, A+K):
    t.add(i)
for i in range(B-K+1, B+1):
    t.add(i)
ans = list(t)
ans.sort()
for a in ans:
    print(a)
A,B,T = map(int, input().split())
for i in range(T/A)
	i += B
print(i)

### FIXED CODE ###

A,B,T = map(int, input().split())
i = int(T/A)
print(B*i)
a=int(input())
b=list(input())
c=0
for i in range(a):
  if b[i]=='A':
    if b[i]+b[i+1]+b[i+2]=='ABC':
      c+=1
print(c)    

### FIXED CODE ###

n=int(input())
s=list(input())
d=0
for i in range(n):
  if n-(i+1)>=2:
    if s[i]=='A' and s[i+1]=='B' and s[i+2]=='C':
      d+=1
  else:
    pass
print(d)
n = input()
ans = 0
if len(n) % 2 == 0:
    length = len(n) - 1
    for i in range(length, -1, -2):
        if i == 1:
            ans += 9
        else:
            plus = '9' * i
            minus = '9' * (i - 1)
            ans += (int(plus) - int(minus))
    print(ans)
else:
    length = len(n)
    ans += (int(n[1:])+1)
    for i in range(length-2, -1, -2):
        if i == 1:
            ans += 9
        else:
            plus = '9' * i
            minus = '9' * (i-1)
            ans += (int(plus) - int(minus))
    print(ans)

### FIXED CODE ###

n = input()
ans = 0
if len(n) % 2 == 0:
    length = len(n) - 1
    for i in range(length, -1, -2):
        if i == 1:
            ans += 9
        else:
            plus = '9' * i
            minus = '9' * (i - 1)
            ans += (int(plus) - int(minus))
    print(ans)
else:
    if int(n) <= 9:
        print(int(n))
    else:
        length = len(n)
        b = '9' * (length-1)
        c = int(n) - int(b)
        ans += c
        for i in range(length-2, -1, -2):
            if i == 1:
                ans += 9
            else:
                plus = '9' * i
                minus = '9' * (i-1)
                ans += (int(plus) - int(minus))
        print(ans)
n = input()
num = []
num = input().split(" ")

t = 0
while true:
  num2 = []
  for i in num:
    if i%2 !=0:
      break
    num2.append(i/2)
   t+=1
   num = num2
prtin(t)

### FIXED CODE ###

n = input()
num = []
num = input().split(" ")
 
t = 0 
a=0 
while True: 
  num2=[] 
  for i in num: 
    if not int(i)%2==0:
      a =1
      break
    num2.append(int(i)/2)
  num = num2
  if a==1: 
     print(t) 
     break
  t+=1
Q=int(input())
n=10010
is_prime=[1]*(n+1)
is_prime[0]=is_prime[1]=0
for i in range(2,n+1):
	for j in range(i*2,n+1,i):
		if is_prime[j]==False:
			continue
		is_prime[j]=0
a=[0]*(n+1)
for i in range(n+1):
	if is_prime[i]%2==0:
		continue
	if is_prime[i] and is_prime[int((i+1)/2)]:
		a[i]=1
s=[0]*(n+1)		
for i in range(n):
	s[i+1]=a[i]+s[i]
for i in range(Q):
	l,r=map(int,input().split())
	print(s[r+1]-s[l])

### FIXED CODE ###

Q=int(input())
n=100000
is_prime=[1]*(n+10)
is_prime[0]=0
is_prime[1]=0
for i in range(2,n+1):
	for j in range(i*2,n+1,i):
		if is_prime[j]==False:
			continue
		is_prime[j]=0
a=[0]*(n+10)
for j in range(2,n+1):
	if is_prime[j]%2==0:
		continue
	if is_prime[j] and is_prime[int((j+1)/2)]:
		a[j]=1
s=[0]*(n+10)		
for k in range(n):
	s[k+1]=a[k]+s[k]
ans=[]
for _ in range(Q):
	l,r=map(int,input().split())
	ans.append(s[r+1]-s[l])
print(*ans,sep='\n')
# -*- coding: utf-8 -*-

import sys
from collections import defaultdict


n, q = [int(x) for x in sys.stdin.readline().rstrip().split(" ")]

tree = defaultdict(set)
data = {}


def add(p, x):
    global data
    data[p] += x
    for p2 in tree[p]:
        add(p2, x)


for _ in range(n - 1):
    a, b = [int(x) for x in sys.stdin.readline().rstrip().split(" ")]
    tree[a].add(b)

for k, v in tree.items():
    data[k] = 0
    for v2 in v:
        data[v2] = 0

for _ in range(q):
    p, x = [int(x) for x in sys.stdin.readline().rstrip().split(" ")]
    add(p, x)

print(" ".join([str(v) for k, v in sorted(data.items(), key=lambda x: x[0])]))


### FIXED CODE ###

# -*- coding: utf-8 -*-

import sys


sys.setrecursionlimit(10**6)


def main():
    n, q = map(int, sys.stdin.readline().split())

    tree = [[] for x in range(n + 1)]
    data = [0 for x in range(n + 1)]

    for _ in range(n - 1):
        a, b = map(int, sys.stdin.readline().split())
        tree[a].append(b)
        tree[b].append(a)

    for _ in range(q):
        p, x = map(int, sys.stdin.readline().split())
        data[p] += x

    def dfs(p, p2, x):
        data[p] += x
        for p3 in tree[p]:
            if p3 == p2:
                continue
            dfs(p3, p, data[p])

    dfs(1, 0, 0)

    print(" ".join([str(x) for x in data[1:]]))


if __name__ == "__main__":
    main()
from itertools import*;n,m,q=map(int,input().split());l=[list(map(int,input().split()))for _ in[0]*q];print(max(sum(d for a in l if i[b-1]-i[a-1]==c)for i in itertools.combinations_with_replacement(range(m),n)))

### FIXED CODE ###

import itertools
n,m,q=map(int,input().split())
abcd=[list(map(int,input().split()))for _ in range(q)]
ans=0
for i in itertools.combinations_with_replacement(range(m),n):
  anss=0
  for a,b,c,d in abcd:
    if i[b-1]-i[a-1]==c:anss+=d
  ans=max(ans,anss)
print(ans)
#ABC138D
def main():
    import sys
    N, Q = map(int, sys.stdin.readline().split())
    ab = [tuple(map(int, sys.stdin.readline().split())) for _ in range(N-1)]
    px = [tuple(map(int, sys.stdin.readline().split())) for _ in range(Q)]
    
    edge = [[] for _ in range(N)]
    #有向グラフ
    for row in ab:
        edge[row[0]-1].append(row[1]-1)
    #print(edge)
    point_list = [0 for i in range(N)]
    for row in px:
        point_list[row[0]-1] += row[1]
    #print(point_list)
    
    sys.setrecursionlimit(1000)
    visited = [-1 for _ in range(N)]
    visited[0] = 0
    def dfs(p):
        for c in edge[p]:
            if visited[c]==-1:
                visited[c]=0
                point_list[c] +=point_list[p]
                dfs(c)
            
    
    dfs(0)
    #print(visited)
    print(*point_list)
        



if __name__=='__main__':
    main()

### FIXED CODE ###

import sys
from collections import deque
sys.setrecursionlimit(1000000)

n,q = map(int, input().split())
a_b = [list(map(int, sys.stdin.readline().split())) for _ in range(n-1)]
p_x = [list(map(int, sys.stdin.readline().split())) for _ in range(q)]

v = [deque([]) for i in range(n)]
for e in a_b:
    v[e[0]-1]+=[e[1]-1]
    v[e[1]-1]+=[e[0]-1]
score = [0 for i in range(n)]
for e in p_x:
    score[e[0]-1]+=e[1]
def dfs(p, bp=-1):
    while v[p]:
        c =v[p].popleft()
        if c ==bp:
            continue
        #print(p, c, bp)
        score[c]+=score[p]
        dfs(c, bp=p)
visited = [0]                
dfs(0)
print(*score)
import sys
input=sys.stdin.readline
def main():
    n,k=map(int,input().split())
    a=list(map(int,input().split()))
    zeros=[0 for i in range(n)]
    if max(a)==0:
        print(*a)
        exit()
    if min(a)==n:
        print(*a)
        exit()
    for i in range(k):
        x=zeros.copy()
        for j in range(n):
            if a[j]==0:
                l=j
                r=j+1
            else:
                l=max(0,j-a[j])
                r=min(j+a[j]+1,n-1)
           # print(l,r)
            x[l]+=1
            if r!=n-1:
                x[r]+=-1
            #print(x)
        ruiseki=[0]*n
        ruiseki[0]=x[0]
        a[0]=ruiseki[0]
        mina=a[0]
        for i in range(1,n):
            ruiseki[i]=ruiseki[i-1]+x[i]
            a[i]=ruiseki[i]
            if a[i]<mina:
                mina=a[i]
        if mina==n:
            print(*a)
            exit()
        #print(*ruiseki)
    print(*a)
if __name__=="__main__":
    main()

### FIXED CODE ###

import sys
input=sys.stdin.readline
def main():
    n,k=map(int,input().split())
    a=list(map(int,input().split()))
    zeros=[0]*n

    if min(a)==n:
        print(*a)
        exit()

    for i in range(k):
        x=zeros.copy()
        for j in range(n):
            if a[j]==0:
                l=j
                r=min(j+1,n)
                #print(l,r)
                x[l]+=1
                if r!=n:
                #print(r)
                    x[r]+=-1
                #print(x)
            else:
                l=max(0,j-a[j])
                r=min(j+a[j]+1,n)
                #print(l,r)
                x[l]+=1
                if r!=n:
                    #print(r)
                    x[r]+=-1
                #print(x)
        ruiseki=[0]*n
        ruiseki[0]=x[0]
        a[0]=ruiseki[0]
        for i in range(1,n):
            ruiseki[i]=ruiseki[i-1]+x[i]
            a[i]=ruiseki[i]
        if min(a)==n:
            print(*a)
            exit()
 
        #print(*ruiseki)
    print(*a)
if __name__=="__main__":
    main()
import sys

sys.setrecursionlimit(10**6)

def gcd(a, b):
    if a % b == 0:
        return b
    else:
        return gcd(b, a%b)

A, B = map(int, input().split())
g = gcd(A, B)


def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

def main():
    cnt = 1  # 1は必ず含まれるので
    data = primes(g)
    for d in data:
        if g % d == 0:
            cnt += 1
    print(cnt)

if __name__ == "__main__":
    main()

### FIXED CODE ###

# 1と素因数の個数の和が答え
# つまりAの素因数を求めて、その中でBの約数となっているものを数えればよい。

def p_factors(x): # prime_factors
    ret = [1]
    check = 2
    while (True):
        if x % check == 0:
            ret.append(check)
            while x % check == 0:
                x = x // check
        check += 1
        if x == 1 or check > int(x**0.5)+1:
            break
    if x != 1:
        ret.append(x)
    return ret

def main():
    A, B = map(int, input().split())
    factors = p_factors(A)
    cnt = 0
    for f in factors:
        if B % f == 0:
            cnt += 1
    print(cnt)

if __name__ == "__main__":
    main()
spots_and_people = input().split()
spot_values = input().split()

N_spot = int(spots_and_people[1])
N_people = int(spots_and_people[0])

spot_values = [ int(value) for value in spot_values ]
spot_values.sort()

line_length = [ spot_values[i+1] - spot_values[i] for i in range(N_spot-1) ]
line_length.sort()
print(line_length)

if N_spot == N_people:
  travel = 0
  
for i in range(N_people-1):
  line_length.pop(-1)
  

print(line_length)

travel = sum(line_length)

print(travel)

### FIXED CODE ###

spots_and_people = input().split()
spot_values = input().split()

N_spot = int(spots_and_people[1])
N_people = int(spots_and_people[0])

spot_values = [ int(value) for value in spot_values ]
spot_values.sort()

line_length = [ spot_values[i+1] - spot_values[i] for i in range(N_spot-1) ]
line_length.sort()


if N_spot <= N_people:
	travel = 0

else:
	for i in range(N_people-1):
  		line_length.pop(-1)
  

	travel = sum(line_length)

print(travel)
def conKey(i, j, k):
    return str(i)+'-'+str(j)+'-'+str(k)


def getKey(s):
    return map(int, s.split('-'))


import heapq
X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

h = []
stack = set([])
ans = []
i, j, k = 0, 0, 0
heapq.heappush(h, (-(A[i]+B[j]+C[k]), conKey(i, j, k)))
stack.add(conKey(i, j, k))
for _ in range(K):
    tmp, key = heapq.heappop(h)
    print(-tmp)
    i, j, k = getKey(key)
    key_0 = [i, j, k]

    for m in range(3):
        key_tmp = key_0.copy()
        key_tmp[m] += 1
        tmp_sum = A[key_tmp[0]] + B[key_tmp[1]] + C[key_tmp[2]]

        str_key = conKey(*key_tmp)
        if str_key not in stack:
            heapq.heappush(h, (-tmp_sum, str_key))
            stack.add(str_key)

### FIXED CODE ###


X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

# まずA, Bで総当たり、上位K個をスタック
tmp = [a+b for a in A for b in B]
tmp.sort(reverse=True)
tmp = tmp[:K]

# 残りのc個に対しても総当たり
ans = [t+c for t in tmp for c in C]
ans.sort(reverse=True)
ans = ans[:K]
for s in ans:
    print(s)
def solve():
    a, b = map(int, input().split(""))
    if a + b >= 10:
        print("error")
    else:
        print(a + b)


solve()

### FIXED CODE ###

def solve():
    a, b = map(int, input().split(" "))
    if a + b >= 10:
        print("error")
    else:
        print(a + b)


solve()
import sys
input = sys.stdin.readline

def main():

    N, M = map(int, input().split())
    Set = []
    for i in range(M):
        Set.append(list(map(int, input().split())))

    for i in range(10**N):
        num = str(i)
        if len(i) == N and all(num[s-1]==str(c) for s,c in Set):
            print(i)
            break
    else:
        print(-1)


if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys
input = sys.stdin.readline

def main():

    N, M = map(int, input().split())
    Set = []
    for i in range(M):
        Set.append(list(map(int, input().split())))

    for i in range(10**N):
        num = str(i)
        if len(num) == N and all(num[s-1]==str(c) for s,c in Set):
            print(i)
            break
    else:
        print(-1)


if __name__ == '__main__':
    main()
n,m,c = map(int,input())
b = list(map(int,input()))
cnt = 0
for i in range(n):
  a = list(map(int,input()))
  res=0
  for j in range(m):
    res += a[i]*b[i]+c
  if res>0: cnt+=1
print(cnt)

### FIXED CODE ###

n,m,c = map(int,input().split())
b = list(map(int,input().split()))
cnt = 0
for i in range(n):
    res=0
    a = list(map(int,input().split()))
    for j in range(m):
        res += a[j]*b[j]
    if res+c>0: cnt+=1
print(cnt)
right = 0
left = len(s)-1

for i in range(len(s)*2):

    if ( s[right] != s[left]):
        count += 1
        if(s[right]!="x"):
            right -= 1

        else:
            left += 1
            
    right += 1
    left -= 1
    if(right>=left):
        print count
        sys.exit()

### FIXED CODE ###

import sys
s = raw_input()

ss = s.replace("x","")

if(ss == ss[::-1]):
    pass

else:
    print "-1"
    sys.exit()


count = 0

right = 0
left = len(s)-1

for i in range(len(s)*2):

    if ( s[right] != s[left]):
        count += 1
        if(s[right]!="x"):
            right -= 1

        else:
            left += 1
            
    right += 1
    left -= 1
    if(right>=left):
        print count
        sys.exit()
a,b=map(input().split())
print(0 if a<b else 10)

### FIXED CODE ###

a,b=map(int,input().split())
print(0 if a<b else 10)
a=[0,0]
s=[]
a[0],a[1],k=map(int,input().split())
for i in range(1,max(a)):
  if a[0]%i==0 and a[1]%i==0:
    s.append(i)
print(s[k-1])


### FIXED CODE ###

a=[0,0]
s=[]
a[0],a[1],k=map(int,input().split())
for i in range(1,min(a)+1):
  if a[0]%i==0 and a[1]%i==0:
    s.append(i)
print(s[len(s)-k])
h,w=map(int,input().split())
s=[input() for i in range(h)]

for i in range(h):
  for j in range(w):
    if s[i][j]=="#":
      continue
    count=0
    
    for dx in [-1,0,1]:
      for dy in [-1,0,1]:
        if 0<=i+dy<h and 0<=j+dx<w and s[i+dy][j+dx]=="#":
          count+=1
    s[i][j]=str(count)
    
for a in s:
  print(''.join(a))



### FIXED CODE ###

H, W = map(int, input().split())
S = [input() for i in range(H)]
offset_h = (-1,-1,-1,0,0,1,1,1)
offset_w = (-1,0,1,-1,1,-1,0,1)
for h in range(H):
  for w in range(W):
    if S[h][w] == "#":
      print("#", end="")
    else:
      bomb = 0
      for i,j in zip(offset_h, offset_w):
        if h+i >= 0 and h+i < H and w+j >=0 and w+j < W and S[h+i][w+j]=="#":
          bomb += 1
            
      print(bomb, end="")
     
  print("")
N = int(input())
h = list(map(int, input().split()))
c = []
tmp = 0
for x in range(len(h)-1, -1, -1):
  if h[x] <= h[x-1]:
    tmp += 1
  else:
    c.append(tmp)
    tmp = 0
print(max(c))


### FIXED CODE ###

N = int(input())
h = list(map(int, input().split()))
c = []
tmp = 0
for x in reversed(range(len(h))):
  if len(h) == 1:
    c.append(0)
  elif h[x] <= h[x-1]:
    tmp += 1
  else:
    c.append(tmp)
    tmp = 0
if len(c) == 0:
  c.append(tmp-1)
print(sorted(c)[-1])
N,A,B = int(input().split(' '))
a = N % (A + B)
b = N // (A + B)

if a > A:
  print(B*b+a)
else:
  print(B*b)

### FIXED CODE ###

Nf,Af,Bf = (input().split(' '))
N = int(Nf)
A = int(Af)
B = int(Bf)
a = N % (A + B)
b = N // (A + B)

if a < A + 1:
  print(A*b+a)
else:
  print(A*b+A)
a,b = [int(i) for i in input().split()]

if a < b:
    print("a < b")
elif a > b:
    print("a > b")
else a == b:
    print("a == b")

### FIXED CODE ###

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

if a < b:
    print("a < b")
elif a > b:
   print("a > b")
else :
    print("a == b")
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under
n,m=map(int,input().split())
if n==0 or n==1:
    print(cmb(m,2))
    quit()
elif m==0 or m==1:
    print(cmb(n,2))
    quit()
print(cmb(n,2)+cmb(m,2))

### FIXED CODE ###

n,m=map(int,input().split())
print((n*(n-1))//2+(m*(m-1))//2)
a=int(input())
B=0
C=0
D=0
B=A
C=a*a
D=a*a*a
print(B+C+D)

### FIXED CODE ###

a=int(input())
B=0
C=0
D=0
B=a
C=a*a
D=a*a*a
print(B+C+D)