Harryxun/stf_run huggingface dataset:
# AGC 007: A – Shik and Stone
H, W = [int(s) for s in input().split()]
A = [input() for _ in range(H)]

isExact = 'Possible'

i, j = 0, 0

while i < H - 1 or j < W - 1:
    A[i] = A[i][:j] + '.' + A[i][j + 1:]

    if A[i + 1][j] != '#' and A[i][j + 1] != '#':
        isExact = 'Impossible'
        break
    if j + 1 < W and A[i][j + 1] == '#':
        j += 1
    elif i + 1 < H and A[i + 1][j] == '#':
        i += 1

if isExact == 'Possible':
    A[H - 1] = A[H - 1][:W - 1] + '.'

    for line in A:
        if '#' in line:
            isExact = 'Impossible'
            break

print(isExact)

### FIXED CODE ###

# AGC 007: A – Shik and Stone
h, w = [int(s) for s in input().split()]
a = [input() for _ in range(h)]

the_number_of_stones = 0

for i in range(h):
    the_number_of_stones += a[i].count('#')

print('Possible' if the_number_of_stones == h + w - 1 else 'Impossible')
A, B, H, M = map(int,input().split())
Ha = H*math.pi/6 + M*math.pi/360
Ma = M*math.pi/30
if Ha == Ma:
    print(abs(A-B))
else:
    print(math.sqrt(A**2 + B**2 - 2*A*B*math.cos(Ha-Ma)))

### FIXED CODE ###

import math
A, B, H, M = map(int,input().split())
Ha = H*math.pi/6 + M*math.pi/360
Ma = M*math.pi/30
if Ha == Ma:
    print(abs(A-B))
else:
    print(math.sqrt(A**2 + B**2 - 2*A*B*math.cos(Ha-Ma)))
N = int(input()) 

ans='' 

while N>0:
	N -= 1
	ans += chr(ord('a') + N % 26) 
    N //= 26
    
print(ans[::-1])


### FIXED CODE ###

N = int(input()) 

ans='' 

while N>0:
	N -= 1
	ans += chr(ord('a') + N % 26) 
	N = N//26
    
print(ans[::-1])
n, k = map(int, input().split())
s = input()
tmp = ord(s[k])
tmp1 = (chr(tmp+32))
ans = []

for i in range(len(s)):
    if i == k:
        ans.append(tmp1)
    else:
        ans.append(s[i])

print("".join(map(str, ans)))

### FIXED CODE ###

n, k = map(int, input().split())
s = input()
tmp = ord(s[k-1])
tmp1 = (chr(tmp+32))
ans = []

for i in range(len(s)):
    if i == k-1:
        ans.append(tmp1)
    else:
        ans.append(s[i])

print("".join(map(str, ans)))
N = int(input())
x = list(map(int, input().split()))
l = []
minx = min(x)
maxx = max(x)
for p in range(minx, maxx):
  s = 0
  for j in range(N):
    s += (x[j]-p)**2
  l.append(s)
minp = min(l)
p = l.index(minp)
p = int(p)
hp1 = 0
hp2 = 0
for i in range(N):
  hp1 += (x[i]-p)**2
  hp2 += (x[i]-p-1)**2
print(min(hp1, hp2))

### FIXED CODE ###

N = int(input())
x = list(map(int, input().split()))
p = int(sum(x)/N)
hp1 = 0
hp2 = 0
for i in range(N):
  hp1 += (x[i]-p)**2
  hp2 += (x[i]-p-1)**2
print(min(hp1, hp2))
N = int(input())

ac = 0
wa = 0
tle = 0
re = 0

for i in range(1,N+1):
  S = str(input())
  if S == "AC":
    ac += 1
  elif S == "WA":
    wa += 1
  elif S == "TLE":
    tle += 1
  elif S == "RE":
    re += 1

print("AC ×" + str(ac))
print("WA ×" + str(wa))
print("TLE ×" + str(tle))
print("AC ×" + str(re))

### FIXED CODE ###

N = int(input())
a = N//1000
b = ((a+1)*1000)-N
if b%1000 == 0:
	b = 0
    
print(b)
n = int(input())
a = list(map(int, input().split()))
k=[]
for i in range(1, n + 1):
  k.append(a.index[i] + 1)
print(k[l] for l in range(n). end =' ')
    


### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
B = [0]* N
for i in range(N):
    B[A[i]-1] = i + 1
print(*B)
import math
import collections
import heapq
from collections import defaultdict
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)


def main():
    n = int(input())
    maxv = n*(n-1)//2
    a = [list(map(lambda x:x-1, list(map(int, input().split()))))
         for i in range(n)]


    # 試合を頂点とする(ex 1-2,2-4 : i < j)
    v = 0  # 頂点数
    # 頂点にIDをふる
    Id = [[-1 for i in range(n)] for j in range(n)]
    for i in range(n):
        for j in range(n):
            if i < j:
                Id[i][j] = v
                Id[j][i] = v
                v += 1

    # 頂点間の辺を貼る
    e = [[] for i in range(maxv)]
    for i in range(n):
        # a[i][j]にIDを代入する Id[1][3]=1 => a[1][3] = a[3][1] = 1
        for j in range(n - 1):
            a[i][j] = Id[i][a[i][j]]

        # 辺をはる
        for j in range(n - 2):
            e[a[i][j]].append(a[i][j+1])


    calculated = [False for i in range(maxv)]
    dp = [-1 for i in range(maxv)]
    def dfs(v):
        if dp[v] != -1:
            if not calculated[v]:
                return -1
            return dp[v]
        dp[v] = 1
        for u in e[v]:
            ret = dfs(u)
            if ret == -1:
                return -1
            dp[v] = max(dp[v], ret + 1)
        calculated[v] = True　#帰りがけ
        return dp[v]
    

    #トポロジカルソート
    ans = 0
    for i in range(v):
        ret = dfs(i)
        if ret == -1:  # サイクル検知
            print(-1)
            exit()
        ans = max(ans, ret)
    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import math
import collections
import heapq
from collections import defaultdict
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)


def main():
    n = int(input())
    maxv = n*(n-1)//2
    a = [list(map(int, input().split())) for i in range(n)]
    for i in range(n):
        for j in range(n-1):
            a[i][j] -= 1
    v = 0
    Id = [[0 for i in range(n)] for j in range(n)]
    for i in range(n):
        for j in range(n):
            if i < j:
                Id[i][j] = v
                v += 1

    def toId(i, j):
        if i > j:
            i, j = j, i
        return Id[i][j]

    to = [[] for i in range(maxv)]
    for i in range(n):
        for j in range(n - 1):
            a[i][j] = toId(i, a[i][j])
        for j in range(n - 2):
            to[a[i][j+1]].append(a[i][j])

    visited = [False for i in range(maxv)]
    calculated = [False for i in range(maxv)]
    dp = [0 for i in range(maxv)]

    def dfs(v):
        if visited[v]:
            if not calculated[v]:
                return -1
            return dp[v]
        visited[v] = True
        dp[v] = 1
        for u in to[v]:
            ret = dfs(u)
            if ret == -1:
                return -1
            dp[v] = max(dp[v], ret + 1)
        calculated[v] = True
        return dp[v]

    ans = 0
    for i in range(v):
        ret = dfs(i)
        if ret == -1:  # detected cycle
            print(-1)
            exit()
        ans = max(ans, ret)
    print(ans)


if __name__ == '__main__':
    main()
n,k = int(input().split(' '))
s = 1
if n%k==0:
	s-=1
print(s)

### FIXED CODE ###

n = list(map(int,input().split(' ')))
s = 1
if n[0]%n[1]==0:
	s-=1
print(s)
a, b = map(int, input().splid())
if (a + b) % 2 == 0 :
  print((a + b) / 2)
else :
  print("IMPOSSIBLE")


### FIXED CODE ###

a, b = map(int, input().split())
if (a + b) % 2 == 0 :
  print((a + b) // 2)
else :
  print("IMPOSSIBLE")
import numpy as np
n = input()
a = np.array([int(e) for e in input().split()])
m = np.lcm.reduce(a) - 1
sum = 0

for i in range(len(a)):
    sum += m%a[i]
print(sum)


### FIXED CODE ###

from functools import reduce
from fractions import gcd

n = input()
a = list(map(int,input().split()))
gd = reduce(gcd,a)
m = reduce(lambda a,b: a*b,a)//gd -1
sum = sum(map(lambda x: m%x,a))

print(int(sum))
s = list(input())
is_count_zero = True
sl = [0]
sl_ptr = 0
for c in s:
    if is_count_zero and c == '1':
        sl.append(1)
        sl_ptr += 1
        is_count_zero = False
    elif not is_count_zero and c == '0':
        sl.append(1)
        sl_ptr += 1
        is_count_zero = True
    else:
        sl[sl_ptr] += 1

# print(sl)
# print("len(sl):{} len(sl)-1)//2:{}".format(len(sl), (len(sl)-1)//2))

if k > (len(sl)-1)//2:
    print(sum(sl))
elif k == (len(sl)-1)//2:
    if sl[0] == 0:
        print(sum(sl))
    else:
        print(max(sum(sl[1:]), sum(sl[:-1])))
else:
    ans = 0
    for i in range((len(sl)+1)//2-(k-1)):
        if i == 0:
            ans = max(ans, sum(sl[:k*2-1]))
            # print("sl[:k*2-1]:{} sum:{}".format(sl[:k*2-1], sum(sl[:k*2-1])))
        else:
            ans = max(ans, sum(sl[i*2-1:(i+k)*2]))
            # print("sl[i*2-1:(i+k)*2-1]: {}".format(sl[i*2-1:(i+k)*2]))
    print(ans)


### FIXED CODE ###

# import sys
# input = sys.stdin.readline

_, k = map(int, input().split())
s = list(map(int, list(input())))
# print(s)
is_count_zero = True
s0 = [0]
s1 = []
s0_ptr = 0
s1_ptr = -1
for c in s:
    if is_count_zero and c == 0:
        s0[s0_ptr] += 1
    elif not is_count_zero and c == 0:
        s0.append(1)
        s0_ptr += 1
        is_count_zero = True
    elif is_count_zero and c == 1:
        s1.append(1)
        s1_ptr += 1
        is_count_zero = False
    else: # not is_count_zero and c == 1
        s1[s1_ptr] += 1

# print(s0,s1)
is_end_one = True if len(s0) == len(s1) else False

if k >= len(s0):
    print(sum(s0)+sum(s1))
# elif k == 0:
#     if s1 == []:
#         print(0)
#     else:
#         print(max(s1))
else:
    ans = 0
    sum_range = 0
    n = len(s0)-k+1
    for i in range(n):
        if i == 0:
            sum_range = sum(s0[:k]) + sum(s1[:k])
            ans = max(ans, sum_range)
        elif i == n-1:
            sum_range = sum(s0[i:]) + sum(s1[i-1:])
            ans = max(ans, sum_range)
        elif i == 1:
            sum_range = sum_range - s0[0] + s0[k] + s1[k]
            ans = max(ans, sum_range)
        elif i != 0:
            sum_range = sum_range - s0[i-1] + s0[i+k-1] - s1[i-2] + s1[i+k-1]
            ans = max(ans, sum_range)
    print(ans)
n = int(input())
# Recursion!
def detector(str):
  # Stop the operation if the number is bigger than n.
  if int(str) > n:
    return 0
  else:
    count = 0
    # Add 7, 5, or 3 after the number. 
    # Eliminate numbers that do not consist of only 3, 5, and 7.
    for i in "753":
      count += detector(str+i)
    # Check if the number has all 3, 5, and 7.
    if "3" not in str or "5" not in str or "7" not in str:
      return count
    else:
      return count += 1
# Start from 0 and do the operation until the number exceeds n.
detector("0")

### FIXED CODE ###

n = int(input())
# Recursion!
def detector(str):
  # Stop the operation if the number is bigger than n.
  if int(str) > n:
    return 0
  else:
    count = 0
    # Add 7, 5, or 3 after the number. 
    # Eliminate numbers that do not consist of only 3, 5, and 7.
    for i in "753":
      count += detector(str+i)
    # Check if the number has all 3, 5, and 7.
    if "3" not in str or "5" not in str or "7" not in str:
      return count
    else:
      return count + 1
# Start from 0 and do the operation until the number exceeds n.
print(detector("0"))
import heapq
N, M = cin()
A = cin()
x = []
for i in range(N):
    heapq.heappush(x, -A[i])
for i in range(M):
    p = -heapq.heappop(x)
    heapq.heappush(x, -(p // 2))
ans = -sum(x)
print(ans)

### FIXED CODE ###

import heapq
N, M = list(map(int,input().split()))
A = list(map(int,input().split()))
x = []
for i in range(N):
    heapq.heappush(x, -A[i])
for i in range(M):
    p = -heapq.heappop(x)
    heapq.heappush(x, -(p // 2))
ans = -sum(x)
print(ans)
S = input().split()
A = int(S[0])
B = int(S[1])
C = int(S[2])
D = int(S[3])

E = int((C * D) / math.gcd(C, D))

X = int(B/C)-int((A-1)/C)
Y = int(B/D)-int((A-1)/D)
Z = int(B/E)-int((A-1)/E)

print(B-A+1-X-Y+Z)



### FIXED CODE ###


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

 #最小公倍数


def lcm(a, b):
    return a*b//gcd(a, b)


S = input().split()
A = int(S[0])
B = int(S[1])
C = int(S[2])
D = int(S[3])

E = lcm(C, D)

X = int(B//C)-int((A-1)//C)
Y = int(B//D)-int((A-1)//D)
Z = int(B//E)-int((A-1)//E)

print(B-A+1-X-Y+Z)
s = list(input())
print(s.replace("?","D"))

### FIXED CODE ###

print(input().replace("?","D"))
from collections import Counter as c
from scipy.misc import comb
from functools import reduce

def f(n):
  d,i=c(),2
  while i*i<=n:
    while n%i==0:
      n//=i
      d[i]+=1
    i+=1
  if n>1:d[n]+=1
  return d.values()

n,m=map(int,input().split())
mod=10**9+7
print(reduce(lambda x,y:x*y%mod,map(lambda x:comb(x+n-1,x,exact=True)%mod,f(m)))%mod)

### FIXED CODE ###

from collections import Counter as c
from scipy.misc import comb
from functools import reduce

def f(n):
  d,i=c(),2
  while i*i<=n:
    while n%i==0:
      n//=i
      d[i]+=1
    i+=1
  if n>1:d[n]+=1
  return d.values()

n,m=map(int,input().split())
mod,v=10**9+7,1
for x in f(m):
  v*=comb(x+n-1,x,exact=True)%mod
print(v%mod)
N,M =[int(i)for i in input().split()]
oya =[[]for i in range(N)]
ko =[[] for i in range(N)]
for _ in range(N+M-1):
    A,B = [int(i)for i in input().split()]
    oya[B-1].append(A-1)
    ko[A-1].append(B-1)
tyouten =oya.index([])
rank =[[-1,-1]for _ in range(N)]
def keisan(num,no,bef):
    if rank[num][0] < no:
        rank[num]=[no,bef]
    for i in ko[num]:
        keisan(i,no+1,num)

keisan(tyouten,0,-1)
for i in rank:
    print(i[1]+1)

### FIXED CODE ###

import queue
N,M =[int(i)for i in input().split()]
adlist =[[]for i in range(N)] #隣接リスト
oyalist =[[]for i in range(N)] #親ノードリスト
for _ in range(N+M-1):
    A,B =[int(i)-1 for i in input().split()]
    adlist[A].append(B)
    oyalist[B].append(A)

iri =[0]*N #入次数のリスト
for i in range(N):
    iri[i] =len(oyalist[i])

topo =[0]*N #トポロジカルソートの番号
tyouten =oyalist.index([]) #頂点
num = 0 #ソート番号
q =queue.Queue()
q.put(tyouten)
topo[tyouten]=num

while num != N-1:
    now = q.get()
    for i in adlist[now]:
        iri[i] -=1
        if iri[i] == 0:
            q.put(i)
            num += 1
            topo[i] =num

#出力
oyalist[tyouten].append(-1)
for i in range(N):
    oyalist[i] =sorted(oyalist[i],key=lambda x:topo[x],reverse=True)
    print(oyalist[i][0]+1)
a,b,c=map(int,input().split())
print(c if a==b else b if a==c else a if b==c)

### FIXED CODE ###

a,b,c=map(int,input().split())
print(c if a==b else b if a==c else a)
N = int(input())

def sum(n):
    s = 0
    if n == 0:
        return 0
    else:
        return n % 10 + sum(n//10)

        
import math
m = sum(N)
for i in range(int(math.log10(N)) + 1):
    n = sum((N // 10**i) * 10**i - 1)
    if n > m:
        m = n


print(m)

### FIXED CODE ###

a = input()
a = list(a)
l = len(a)
for i in range(l):
    a[i] = int(a[i])
m = sum(a)
for i in range(l):
    n = a[i]-1 + 9*(l-i-1)
    if n > m:
        m = n
print(m)
p, q, r = map(int, input().split())
ans = min(a+b, b+c, c+a)
print(ans)

### FIXED CODE ###

p, q, r = map(int, input().split())
ans = min(p+q, q+r, r+p)
print(ans)
import sys
input = sys.stdin.readline

S = input()
l = len(S)
no_zero_dic = {}
dp = [[0] * (2019) for i in range(l)]
ans = 0
for i in range(l):
    s = int(S[i])
    no_zero_dic[s] = 1
    _x = set(no_zero_dic.keys())
    for j in _x:
        k = (10 * j + s) % 2019
        dp[i][k] = dp[i-1][j]
        if dp[i-1][j] > 0:
            no_zero_dic[k] = 1
        if k == 0:
            ans += dp[i][k]
    dp[i][s] += 1


print(ans)


### FIXED CODE ###

import sys
input = sys.stdin.readline

S = input().strip()
l = len(S)
dic = {0:[-1]}
ans = 0
base = 1
mod = 0
for i in range(0, l):
    base = (10 * base) % 2019
    s = base * int(S[l-1-i]) + mod
    mod = s % 2019
    if mod in dic:
        dic[mod].append(i)
    else:
        dic[mod] = [i]

for key, val in dic.items():
    v_len = len(val)
    ans += (v_len * (v_len -1))// 2

print(ans)
n = int(input())
a = [int(input()) for i in range(n)]
q = set(sorted(a))

for i in range(n):
  if a[i] != q[-1]:
    print(q[-1])
  else:
    print(q[-2])

### FIXED CODE ###

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

for i in range(n):
  if a[i] != q[-1]:
    print(q[-1])
  else:
    print(q[-2])
if N < 10:
    print(N)
elif N >= 10 and N < 100:
    print(9)
elif N >= 100 and N < 1000:
    print(N - 90)
elif N >= 1000 and N < 10000:
    print(909)
elif N >= 10000 and N < 100000:
    print(N-9090)
else:
    print(90909)

### FIXED CODE ###

A,B,C = map(int, input().split())
if B >= 1 and A >= B and A <= 20 and C >= 1 and C <= 20:
    capacity = A - B
    if capacity <= C:
        remaining = C - capacity
    else:
        remaining = 0
    print(remaining)
N=int(input())
a_list=[int(input()) for i in range(N)]
print(a_list)
    
a_max=max(a_list)
a_min=min(a_list)
print(a_max-a_min)
    

### FIXED CODE ###

N=int(input())
a=list(map(int,input().split())) 
a_max=max(a)
a_min=min(a)
print(a_max-a_min)
import math
a,b,x=map(int,input().split())
if a*a*b/2>x:
  print(math.degrees(math.atan(a*a*b/2*x))
else   
  print(math.degrees(math.atan(2-2*x/a*a*b))

### FIXED CODE ###

import math
a,b,x=map(int,input().split())
if (a*a*b)/2>x:
  print(math.degrees(math.atan(a*b*b/(2*x))))
else:
  print(math.degrees(math.atan(2*(a*a*b-x)/(a*a*a))))
n, k = map(lambda x: int(x), input().split())

total = [[0, 0]] * k
for i in range(n):
    number, copies = map(lambda x: int(x), input().split())
    total[i] = [number, copies]

total.sort(key=lambda x: x[0])


count = i = 0
while count < K:
    count += total[i][1]
    if count < K:
        i += 1

print(total[i][0])
                         
                      

### FIXED CODE ###

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

ab = [[0, 0]] * N
for i in range(N):
    _a, _b = map(int, input().split())
    ab[i] = [_a, _b]
ab.sort(key=lambda x:x[0])

j = 0
index = 0
while j < K:
    j += ab[index][1]
    if j < K:
        index += 1

print(ab[index][0])
import sys
import math
import functools
import numpy as np
stdin = sys.stdin
mod = 10**9 + 7

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
sa = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
def lcm(a, b):
    return a * b // gcd (a, b)
def lcm_n(nums):
    return functools.reduce(lcm, nums)

n = ni()
a = na()
a_lcm = lcm_n(a)
a = np.array(a)
# ans = 0
# for ai in a:
#     ans += a_lcm // ai
#     ans %= mod
# print(ans)
ans = np.sum(a_lcm // a) % mod
print(ans)

### FIXED CODE ###

import sys
import math
import functools
stdin = sys.stdin
mod = 10**9 + 7

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
sa = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
def lcm(a, b):
    return a * b // gcd (a, b)
def lcm_n(nums):
    return functools.reduce(lcm, nums)

n = ni()
a = na()
a_lcm = lcm_n(a)
ans = 0
for ai in a:
    ans += a_lcm // ai
ans %= mod
print(ans)
import numpy as np
from numba import jit
@jit
def search(N, K, ps, ps_means, maxval):
    for i in range(N):
        ps_means[i] = ((1 + ps[i]) * ps[i])/ 2
        if i + 1 >= K:
            a = ps[i-K+1:i+1]
            b = 1 / a  #[np.delete(a, i).prod() for i in range(K)]
            c = ps_means[i-K+1:i+1] * b
            sumval = np.sum(c)  #/ a.prod()
            if sumval > maxval:
                maxval = sumval
    return maxval

def main():
    N, K = map(int, input().split(" "))
    ps = np.array(input().split(" "))
    ps = ps.astype("int64")

    ps_means = np.zeros(N)
    maxval = 0
    ans = search(N, K, ps, ps_means, maxval)
    print(ans)

if __name__ == '__main__':
    main()

### FIXED CODE ###

import numpy as np
 
def main():
    N, K = map(int, input().split(" "))
    ps = np.array(input().split(" "))
    ps = ps.astype("int64")
 
    ps_means = np.zeros(N)
    maxval = 0
 
    for i in range(N):
        ps_means[i] = ((1 + ps[i]) * ps[i])/ 2
        if i + 1 >= K:
            if i + 1 == K:
                sumval = np.sum(ps_means[i-K+1:i+1] / ps[i-K+1:i+1])
            else:
                sumval -= ps_means[i-K] / ps[i-K]
                sumval += ps_means[i] / ps[i]
            if sumval > maxval:
                maxval = sumval
 
    ans = maxval
    print(ans)
 
if __name__ == '__main__':
    main()
S = list(input())
T = list(input())
s = len(S)
t = len(T)
OK = False
P = 0
for i in range(s - t + 1):
    if S[i] != T[0] and S[i] != '?':
        continue
    for j in range(1, t):
        if S[i + j] != T[j] and S[i + j] != '?':
            break
        if j == t - 1:
            OK = True
            P = i
for k in range(t):
    S[P + k] = T[k]
for i in range(s):
    if S[i] == '?':
        S[i] = 'a'
if OK:
    [print(S[i], end='') for i in range(s)]
    print('')
else:
    print('UNRESTORABLE')

### FIXED CODE ###

import sys
S = input()
T = input()
s = len(S)
t = len(T)
if s < t:
    print('UNRESTORABLE')
    sys.exit()

for i in range(s - t, -1, -1):
    OK = True
    for j in range(t):
        if S[i + j] != T[j] and S[i + j] != '?':
            OK = False
    if OK:
        for j in range(t):
            SS = S[:i] + T + S[i + j + 1:]
            SS = SS.replace('?', 'a')
        print(SS)
        sys.exit()

print('UNRESTORABLE')
c=[0]*114514;input();for i in map(int,input().split()):;    c[i]+=1;print(max([sum(c[i:i+3]) for i in range(100000)]))

### FIXED CODE ###

import numpy as np;c=[0]*10**5;input()
for i in map(int,input().split()):
    c[i]+=1
print(max([sum(c[i:i+3]) for i in range(10**5)]))
while 1:
    H,W = map(int,input().split())
    if H == 0 or W == 0:
        break
    else:
        x = ["#"] * W
        for i in(H+1):
            print(x)

### FIXED CODE ###

while 1:
    H,W = map(int,input().split())
    if H == 0 and W == 0:
        break
    x = "#" * W
    for i in range(H):
        print(x)
    print("")
def run(n):
    if n % 2 == 0:
        return n
    else:
        return n * 2


def read_line():
    n = map(int, input().split())
    return n


def main():
    n = read_line()
    print(run(n))


if __name__ == '__main__':
    main()


### FIXED CODE ###

def run(n):
    if n % 2 == 0:
        return n
    else:
        return n * 2


def read_line():
    n = int(input())
    return n


def main():
    n = read_line()
    print(run(n))


if __name__ == '__main__':
    main()
import numpy as np

H, W = map(int, input().split())
arr=np.array([])
s=0
while s != H:
  li=list(input())
  li=np.array(li)
  arr=np.hstack((arr,li))

  s+=1
arr=arr.reshape((H,W))
count=0
def check(x,y):
    global count
    if arr[x,y] == "#":
        count+=1

for x in range(H):
    stri=""
    for y in range(W):
        if arr[x,y] == ".":
            count=0
            top= None
            right =None
            left=None
            if y != 0:
                top=True
                check(x,(y-1))
            if x != 0:
                if top:
                    check((x-1),(y-1))
                check((x-1),y)
                left=True
            if x != (W-1):
                if top:
                    check((x+1),(y-1))
                right=True
                check((x+1),y)
            if y != (H-1):
                if left:
                    check(x-1,y+1)
                if right:
                    check(x+1,y+1)
                check(x,(y+1))
            print(str(count),end="")
        else:
            print("#",end="")
    print("")


### FIXED CODE ###

h,w=map(int,input().split())
lis=[input() for i in range(h)]
outs=[]
for x in range(h):
    s=""
    for y in range(w):
        if lis[x][y]==".":
            c=0
            for xi,yi in [(1,1),(1,0),(1,-1),(0,1),(0,-1),(-1,1),(-1,0),(-1,-1)]:
                if not (xi+x==-1 or yi+y==-1 or xi+x==h or yi+y==w):
                    c+=(1 if lis[xi+x][yi+y]=="#" else 0)
            s+=str(c)
        else:
            s+="#"
    outs.append(s)
for i in outs:
    print(i)