Harryxun/stf_run huggingface dataset:
#import random

def putmx(lis):
  ret=[]
  mx=max(lis)
  for i in range(len(lis)):
    if mx==lis[i]:
      ret.append(i)
  return ret
  

h,w,m=map(int,input().split())
#inp=[(random.randrange(1,h+1),random.randrange(1,w+1)) for i in range(m)]
hb=[0]*h
wb=[0]*w
bmb=[]
for i in range(h):
  bmb.append({-1})
for i in range(m):
  hh,ww=map(int,input().split())
  hh-=1
  ww-=1
  bmb[hh].add(ww)
  hb[hh]+=1
  wb[ww]+=1

#hmx=[i for i, x in enumerate(hb) if x == max(hb)]
#wmx=[i for i, x in enumerate(wb) if x == max(wb)]
hmx=putmx(hb)
wmx=putmx(wb)
mhb=max(hb)
mwb=max(wb)
#print(hb,wb,hmx,wmx)
if len(hmx)>len(wmx):
  ll=set(wmx)
  bl=hmx
else:
  ll=set(hmx)
  bl=wmx
fl=False
for i in bl:
  if len(bmb[i]&ll)>0:
      print(mhb+mwb-1)
      fl=True
      break
  if fl:
    break
else:
  print(mhb+mwb)


### FIXED CODE ###

#import random

def putmx(lis,mx):
  ret=[]
  for (i,j) in zip(range(len(lis)),lis):
    if j==mx:
      ret.append(i)
  return ret
  

h,w,m=map(int,input().split())
hb=[0]*h
wb=[0]*w
bmb=[]
for i in range(h):
  bmb.append({-1})
for i in range(m):
  hh,ww=map(int,input().split())
  hh-=1
  ww-=1
  bmb[hh].add(ww)
  hb[hh]+=1
  wb[ww]+=1
mhb=max(hb)
mwb=max(wb)
hmx=putmx(hb,mhb)
wmx=set(putmx(wb,mwb))

#print(hb,wb,hmx,wmx)
fl=False
for i in hmx:
  if wmx|bmb[i]!=bmb[i]:
    print(mhb+mwb)
    break
else:
  print(mhb+mwb-1)

#print(hmx,wmx,bmb)
A,B = list(input())
if int(A) < 6:
  out = 0
elif int(A) > 12:
  out = int(B)
else:
  out = int(B) // 2
print(out)

### FIXED CODE ###

A,B = input().split()
if int(A) < 6:
  out = 0
elif int(A) > 12:
  out = int(B)
else:
  out = int(B) // 2
print(out)
k=int(input())
s=str(input())
if len(s)>k:
  print(s[0:k]+"...")
elif:
  print(s)

### FIXED CODE ###

k=int(input())
s=str(input())
if len(s)>k:
  print(s[0:k]+"...")
else:
  print(s)
### ----------------
### ここから
### ----------------

import sys
from io import StringIO
import unittest

def yn(b):
    print("Yes" if b==1 else "No")
    return

def resolve():
    readline=sys.stdin.readline

    #n,m,k=map(int, readline().rstrip().split())
    #arr=list(map(int, readline().rstrip().split()))
    n=int(readline())
    ss=readline().rstrip()
    j=len(ss)
    ans=0
    if j==1:
        print(0)
        return
    for i in range(len(ss)):
        if ss[i]=="W":
            j-=1
            if j >= 0:
                while ss[j]!="R":
                    j-=1
            if j > i:
                ans+=1
    print(ans)

    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

### ----------------
### ここまで 
### ----------------

### FIXED CODE ###

### ----------------
### ここから
### ----------------

import sys
from io import StringIO
import unittest

def yn(b):
    print("Yes" if b==1 else "No")
    return

def resolve():
    readline=sys.stdin.readline

    #n,m,k=map(int, readline().rstrip().split())
    #arr=list(map(int, readline().rstrip().split()))
    n=int(readline())
    ss=readline().rstrip()
    j=len(ss)
    ans=0
    if j==1:
        print(0)
        return
    for i in range(len(ss)):
        if ss[i]=="W":
            j-=1
            if j >= 0:
                while ss[j]!="R":
                    j-=1
                    if j < 0:
                        break
            if j > i:
                ans+=1
    print(ans)

    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

### ----------------
### ここまで 
### ----------------
import sys

def main(lines):
    # このコードは標準入力と標準出力を用いたサンプルコードです。
    # このコードは好きなように編集・削除してもらって構いません。
    # ---
    # This is a sample code to use stdin and stdout.
    # Edit and remove this code as you like.

    for i, v in enumerate(lines):
        print("line[{0}]: {1}".format(i, v))
        
if __name__ == '__main__':
    lines = []
    for l in sys.stdin:
        lines.append([int(s) for s in l.rstrip('\r\n').split()])
A=lines[0]
B=lines[1]
print(A*B)

### FIXED CODE ###

import sys

def main(lines):
    # このコードは標準入力と標準出力を用いたサンプルコードです。
    # このコードは好きなように編集・削除してもらって構いません。
    # ---
    # This is a sample code to use stdin and stdout.
    # Edit and remove this code as you like.

    for i, v in enumerate(lines):
        print("line[{0}]: {1}".format(i, v))
        
if __name__ == '__main__':
    lines = []
    for l in sys.stdin:
        lines.append([int(s) for s in l.rstrip('\r\n').split()])
A=lines[0][0]
B=lines[0][1]
print(A*B)
N = int(input())
A = []
for i in range(1, N+1) :
    a = int(input())
    A.append(a)
print(A)

ma = max(A)
mi = min(A)

print(ma - mi)

### FIXED CODE ###

n = int(input())
A = input().split()
for i in range(len(A)) :
    A[i] = int(A[i])
print(max(A)-min(A))
X, Y, Z, K = map(int, input().split())

A_list = list(map(int, input().split()))
B_list = list(map(int, input().split()))
C_list = list(map(int, input().split()))

def qsort(inlist, reverse=True):
    if inlist == []: 
        return []
    else:
        pivot = inlist[0]
        if reverse == False:
            lesser = qsort([x for x in inlist[1:] if x < pivot])
            greater = qsort([x for x in inlist[1:] if x >= pivot])
        else:
            lesser = qsort([x for x in inlist[1:] if x >= pivot])
            greater = qsort([x for x in inlist[1:] if x < pivot])
        return lesser + [pivot] + greater
      
val_list = []


A_list = qsort(A_list, reverse=True)
B_list = qsort(B_list, reverse=True)
C_list = qsort(C_list, reverse=True)

#print(A_list)
#print(B_list)
#print(C_list)

for a in range(len(A_list)):
    if a + 1 > K:
        break
    for b in range(len(B_list)):
        if b + 1 > K:
            break
        if (a+1) * (b+1) > K:
            break
            
        for c in range(len(C_list)):
            if c + 1 > K:
                break
            if (a+1) * (b+1) * (c+1) > K:
                break
        
            val_list.append(A_list[a] + B_list[b] + C_list[c])

val_list = qsort(val_list, reverse=True)
for i in range(K):
    print(val_list[i])

    


            


### FIXED CODE ###

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

A_list = list(map(int, input().split()))
B_list = list(map(int, input().split()))
C_list = list(map(int, input().split()))

val_list = []


A_list = sorted(A_list, reverse=True)
B_list = sorted(B_list, reverse=True)
C_list = sorted(C_list, reverse=True)

#print(A_list)
#print(B_list)
#print(C_list)

for a in range(len(A_list)):
    if a + 1 > K:
        break
    for b in range(len(B_list)):
        if b + 1 > K:
            break
        if (a+1) * (b+1) > K:
            break
            
        for c in range(len(C_list)):
            if c + 1 > K:
                break
            if (a+1) * (b+1) * (c+1) > K:
                break
        
            val_list.append(A_list[a] + B_list[b] + C_list[c])

val_list = sorted(val_list, reverse=True)
for i in range(K):
    print(val_list[i])
s=input()
i=0
for tmp in s:
  i+=1
  if i%2==0:
    if tmp in ['L','U','D']:
    else:
      print('No')
      break
  break
  else:
    if tmp in ['R','U','D']:
    else:
      print('No')
      break
  break
print('Yes')    
    

### FIXED CODE ###

s=input()
i=0
for tmp in list(s):
  i+=1
  if i%2==0:
    if tmp in ['L','U','D']:
      x='Y'  
      continue
    else:
      x='N'
      break
  else:
    if tmp in ['R','U','D']:
      x='Y'  
      continue
    else:
      x='N'
      break
  break
if x=='N':
    print('No')
else:
    print('Yes')
L = list[map(int,input().split())]
M = L.sort()
print(L[2]-L[0])

### FIXED CODE ###

l=sorted(map(int,input().split()))
print(l[-1]-l[0])
from collections import Counter
n, k = map(int, input().split())
A = list(map(lambda x: int(x)-1, input().split()))


visited = [0]*n


def dfs(v):
    if visited[v]+1 == 3:
        return 0
    visited[v] += 1
    dfs(A[v])


dfs(0)

c = Counter(visited)
loop_cnt = c[2]
init_cnt = c[1]
k -= init_cnt
k %= loop_cnt

cnt = 0
visited = [0]*n


ans = 0
for _ in range(k+init_cnt):
    ans = A[ans]
print(ans+1)


### FIXED CODE ###

from collections import Counter
import sys
sys.setrecursionlimit(10**7)
n, k = map(int, input().split())
A = list(map(lambda x: int(x)-1, input().split()))

# A[0]から出発して何回でループするか数える

visited = [0]*n


def dfs(v):
    if visited[v]+1 == 3:
        return 0
    visited[v] += 1
    dfs(A[v])


dfs(0)

c = Counter(visited)
loop_cnt = c[2]
init_cnt = c[1]
k_ = k-init_cnt
k_ %= loop_cnt

cnt = 0
visited = [0]*n


ans = 0
loop = k if k < init_cnt else k_+init_cnt
for _ in range(loop):
    ans = A[ans]
print(ans+1)
N, X = map(int, input().split())

if X > N * 500:
  return Yes
return No

### FIXED CODE ###

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

if X <= N * 500:
    print("Yes")
else:
    print("No")
input = input()
if 0 <= input < 86400:
    hour = int(input / 3600)
    minute = int((input / 60) % 60)
    seconde = int(input % 60)
    print("%d:%d:%d" % (hour,minute,seconde))

### FIXED CODE ###

input = int(input())
if 0 <= input < 86400:
    hour = input / 3600
    minute = (input / 60) % 60
    second = input % 60
    print("%d:%d:%d" % (hour,minute,second))
N = int(input())

BLACK = -1
GRAY = 0
WHITE = 1
nodes = [GRAY] * N
nodes[0] = BLACK
neighbors = [[] for _ in range(N)]

for n in range(N-1):
    u, v, w = [int(i) for i in input().split()]
    neighbors[u-1].append((v-1, w))
    neighbors[v-1].append((u-1, w))

for u in range(N):
    neiss = neighbors[u]
    for neis in neiss:
        v, w = neis
        if nodes[u] == GRAY and nodes[v] == GRAY:
            next
        if nodes[u] == GRAY:
            if w % 2 == 0:
                nodes[u] = nodes[v]
            else:
                nodes[u] = -nodes[v]
        if nodes[v] == GRAY:
            if w % 2 == 0:
                nodes[v] = nodes[u]
            else:
                nodes[v] = -nodes[u]

for u in range(N):
    neiss = neighbors[u]
    for neis in neiss:
        v, w = neis
        if nodes[u] == GRAY and nodes[v] == GRAY:
            next
        if nodes[u] == GRAY:
            if w % 2 == 0:
                nodes[u] = nodes[v]
            else:
                nodes[u] = -nodes[v]
        if nodes[v] == GRAY:
            if w % 2 == 0:
                nodes[v] = nodes[u]
            else:
                nodes[v] = -nodes[u]

for u in range(N):
    neiss = neighbors[u]
    for neis in neiss:
        v, w = neis
        if nodes[u] == GRAY and nodes[v] == GRAY:
            next
        if nodes[u] == GRAY:
            if w % 2 == 0:
                nodes[u] = nodes[v]
            else:
                nodes[u] = -nodes[v]
        if nodes[v] == GRAY:
            if w % 2 == 0:
                nodes[v] = nodes[u]
            else:
                nodes[v] = -nodes[u]

for n in nodes:
    if n == BLACK:
        print(0)
    else:
        print(1)


### FIXED CODE ###

n, k = [int(i) for i in input().split()]
s = input()

a = s[:k-1]
c = s[k-1]
b = s[k:]

if c == 'A':
    print(a + 'a' + b)
elif c == 'B':
    print(a + 'b' + b)
else:
    print(a + 'c' + b)
n,m = map(int, input().split())

if n*2 <= m:
    ma = m-n*2
    ans = n+(ma//4)
    
else:
    ans = ma//2

print(ans)

### FIXED CODE ###

n,m = map(int, input().split())

if n*2 <= m:
    ma = m-n*2
    ans = n+(ma//4)
    
else:
    ans = m//2

print(ans)
from itertools import product
D, G = map(int, input().split())
P, C = zip(*[map(int, input().split()) for _ in range(D)])
INF = 10**18
ans = INF
for bit in product((0, 1), repeat=D):
    p = list(P)
    cnt = 0
    score = 0
    for i in range(D):
        if bit[i]:
            score += C[i]
            score += P[i]*100*(i+1)
            cnt += P[i]
            p[i] = 0


        if score+sum(p[i]*100*(i+1) for i in range(D)) < G:
        	continue
 
    idx = D-1
    while score < G:
        while not p[idx]:
            idx -= 1
        score += 100*(idx+1)
        p[idx] -= 1
        cnt += 1
    if cnt < ans:
        ans = cnt
print(ans)


### FIXED CODE ###

from itertools import product
D, G = map(int, input().split())
P, C = zip(*[map(int, input().split()) for _ in range(D)])
INF = 10**18
ans = INF
for bit in product((0, 1), repeat=D):
    p = list(P)
    cnt = 0
    score = 0
    for i in range(D):
        if bit[i]:
            score += C[i]
            score += P[i]*100*(i+1)
            cnt += P[i]
            p[i] = 0
 
    if score+sum(p[i]*100*(i+1) for i in range(D)) < G:
        continue
 
    idx = D-1
    while score < G:
        while not p[idx]:
            idx -= 1
        score += 100*(idx+1)
        p[idx] -= 1
        cnt += 1
    if cnt < ans:
        ans = cnt
print(ans)
N = list(map(int, input().split()))
A = list(map(int, input().split()))

isApprove = True

for x in A:
    if x % 2 == 0:
        if (x % 3 != 0) or (x % 5 != 0):
            isApprove = True
            print('DENIED')
            return 

print ('APPROVED')

### FIXED CODE ###

import sys

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

for x in A:
    if (x % 2 == 0) and (x % 3 != 0) and (x % 5 != 0):
        print('DENIED')
        sys.exit()

print ('APPROVED')
import sys
input = sys.stdin.readline
n = int(input())
f = []
for i in range(n):
  f.append(list(map(int, input().split())))
p = []
for i in range(n):
  p.append(list(map(int, input().split())))

cand = []
for i in range(1, 2 ** 20):
  for j in range(20):
    cnt = [0] * n
    if i & (1 << j):
      for k in range(n):
        if f[k][j]:
          cnt[k] += 1
    v = 0
    for k in range(n):
      v += p[k][cnt[k]]
    cand.append(v)
    
print(max(cand))
  

### FIXED CODE ###

import sys
input = sys.stdin.readline
n = int(input())
f = []
for i in range(n):
  f.append(list(map(int, input().split())))
p = []
for i in range(n):
  p.append(list(map(int, input().split())))

cand = []
for i in range(1, 2 ** 10):
  cnt = [0] * n
  for j in range(10):
    if i & (1 << j):
      for k in range(n):
        if f[k][j]:
          cnt[k] += 1
  v = 0
  for k in range(n):
    v += p[k][cnt[k]]
  cand.append(v)
    
print(max(cand))
def main():
    n = int(input())
    l = []
    
    if(n<0 or n>1000000000):
        main()
    
    h1 = int(n/500)*1000
    ar = n - (h1/int(n/500))
    h1+=int(ar/5)*5
    h2 = int(n/5)*5

    l.append(h1)
    l.append(h2)
    print(max(l))

main()

### FIXED CODE ###

def main():
    n = int(input())
    l = []
    
    if(n<0 or n>1000000000):
        main()
    
    
    if(n!=0):
        h1 = int(n/500)*1000
        ar = n - (int(n/500)*500)
        h1+=int(ar/5)*5
        h2 = int(n/5)*5
        
        l.append(h1)
        l.append(h2)
        print(max(l))
    else:
        print(0)

main()
def dfs(v, c, total):
	if color[v] != -1:
		return
	color[v] = c
	for x in glaph[v]:
		u, w = x[0], x[1]
		total+=w
		if total%2 == 0:
			dfs(u, 0, total)
		else:
			dfs(u, 1, total)
			
n = int(input())
glaph = [[]*n for _ in range(n)]
color = [-1]*n

for _ in range(n-1):
	u,v,w = map(int, input().split())
	glaph[u-1].append((v-1, w))
	glaph[v-1].append((u-1, w))	

dfs(0, 0, 0)
for i in color:
	print(i)

### FIXED CODE ###

import sys
sys.setrecursionlimit(pow(10, 7))

def dfs(v, c, parent):
	color[v] = c
	for x in glaph[v]:
		u, w = x[0], x[1]
		if color[u] != -1:
			continue
		if w%2 == 0:
			dfs(u, c, v)
		else:
			dfs(u, 1-c, v)
			
n = int(input())
glaph = [[]*n for _ in range(n)]
color = [-1]*n

for _ in range(n-1):
	u,v,w = map(int, input().split())
	glaph[u-1].append((v-1, w))
	glaph[v-1].append((u-1, w))	

dfs(v=0, c=0, parent=0)
#for i in range(n):
#	print(i, glaph[i])
for i in color:
	print(i)
a,b,c,d=0,0,0,0
N=int(input())
S=[input() for _ in range(N)]
for i in range(N):
    if S[i]=='AC':
        a=a+1
    elif S[i]=='WA':
        b=b+1
    elif S[i]=='TLE':
        c=c+1
    elif S[i]=='RE':
        d=d+1
print('AC x　'+str(a))        
print('WA ×　'+str(b))    
print('TLE ×　'+str(c))       
print('RE ×　'+str((d)) 

### FIXED CODE ###

n = int(input())
ans_ac = 0
ans_wa = 0
ans_tle = 0
ans_re = 0

for i in range(n):
    s = input()
    if s == 'AC':
        ans_ac += 1
    elif s == 'WA':
        ans_wa += 1
    elif s == 'TLE':
        ans_tle += 1
    else:
        ans_re += 1
        
print('AC x '+str(ans_ac))
print('WA x '+str(ans_wa))
print('TLE x '+str(ans_tle))
print('RE x '+str(ans_re))
#C
A,B = map(int,input().split())
C = str(A*B)
print(C.split('.')[0])

### FIXED CODE ###

#C
A,B = input().split()
A = int(A)
B = round(float(B)*100)
 
res = (A*B)//100
print(res)
N = int(input())

count = 0

if N < 10:
    print(N)
elif N < 100:
    print(9)
elif N < 1000:
    print(9 + min(N,999) - 100 + 1)
elif N < 10000:
    print(9 + 900)
elif N < 100000:
    print(9 + 900 + min(N , 99999) - 10000 + 1)
else:
    print(90909)

### FIXED CODE ###

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

print(max(0, c-(a-b)))
#coding:utf-8

a, b = map(int, raw_input(). split())
print(a * b / 3.305785)

### FIXED CODE ###

#coding:utf-8

a, b = map(int, raw_input(). split())
print(a * b / 3.305785)
import sys
def f(c,h=0):
 if 2 in c and sum(c)==2:return 1
 if 5 in c:return 0  # sum(c)==2
 if 4 in c:
     k=c.index(4);c[k]-=3
     if f(c,h+1):return 1
     c[k]+=3
 if 3 in c:
     k=c.index(3);c[k]-=3
     if f(c,h+1):return 1
     c[k]+=3
 for i in range(7):
  if c[i]and c[i+1]and c[i+2]:
      c[i]-=1;c[i+1]-=1;c[i+2]-=1
      if f(c,h+1):return 1
      c[i]+=1;c[i+1]+=1;c[i+2]+=1
n='123456789'
for e in sys.stdin:
 e=list(e.strip())
 a=[i for i in n if f([(e+[i]).count(j)for j in n])]
 print(*a if a else 0)


### FIXED CODE ###

import sys
def f(c):
 if sum(c)in c:return 1
 if 5 in c:return 0
 if 4 in c:
  k=c.index(4);c[k]-=3
  if f(c):return 1
  c[k]+=3
 if 3 in c:
  k=c.index(3);c[k]-=3
  if f(c):return 1
  c[k]+=3
 for i in range(7):
  if c[i]and c[i+1]and c[i+2]:
   c[i]-=1;c[i+1]-=1;c[i+2]-=1
   if f(c):return 1
   c[i]+=1;c[i+1]+=1;c[i+2]+=1
n='123456789'
for e in sys.stdin:
 c=[list(e).count(j)for j in n]
 a=[]
 for i in range(9):
  t=c[:];t[i]+=1
  if f(t):a+=[i+1]
 if a:print(*a)
 else:print(0)
MOD = 10 ** 9 + 7


def comb(n, k):
    N = n + k + 1
    fact = [1] * (N + 1)
    rfact = [1] * (N + 1)
    r = 1
    for i in range(1, N + 1):
        fact[i] = r = r * i % MOD

    rfact[N] = r = pow(fact[N], MOD - 2, MOD)
    for i in range(N, 0, -1):
        rfact[i - 1] = r = r * i % MOD
    return fact[n] * rfact[k] * rfact[n - k] % MOD


X, Y = map(int, input().split())
x = 2 * X - Y
y = 2 * Y - X

if x % 3 and y % 3:
    print(0)
else:
    xx = x // 3
    yy = y // 3
    print(comb(xx + yy, xx))

### FIXED CODE ###

MOD = 10 ** 9 + 7


def comb(n, k):
    N = n + k + 1
    fact = [1] * (N + 1)
    rfact = [1] * (N + 1)
    r = 1
    for i in range(1, N + 1):
        fact[i] = r = r * i % MOD

    rfact[N] = r = pow(fact[N], MOD - 2, MOD)
    for i in range(N, 0, -1):
        rfact[i - 1] = r = r * i % MOD
    return fact[n] * rfact[k] * rfact[n - k] % MOD


X, Y = map(int, input().split())
x = 2 * X - Y
y = 2 * Y - X

if (x % 3 and y % 3) or x < 0 or y < 0:
    print(0)
else:
    xx = x // 3
    yy = y // 3
    print(comb(xx + yy, xx))
a =int(intput())
a = a**3
print(a)

### FIXED CODE ###

x = int(input())
x = x**3
print(x)
#!/usr/bin/env python3

import numpy as np


def next_line():
    return input()


def next_int():
    return int(input())


def next_int_array_one_line():
    return list(map(int, input().split()))


def next_int_array_multi_lines(size):
    return [int(input()) for _ in range(size)]


def next_str_array(size):
    return [input() for _ in range(size)]


def main():
    r, c, k = map(int, input().split())
    dp = [[[0] * (c+1) for i in range(r+1)] for i in range(4)]
    v = [[0] * (c+1) for i in range(r+1)]
    for i in range(k):
        row, col, val = map(int, input().split())
        v[row][col] = val

    for row in range(1, r + 1):
        for col in range(1, c + 1):
            for num in range(0, 4):
                if num == 0:
                    dp[num][row][col] = dp[3][row-1][col]  # simple down
                else:
                    dp[num][row][col] = max(dp[num-1][row][col],  # str
                                            dp[num][row][col-1],  # right x
                                            dp[3][row-1][col] + \
                                            v[row][col],  # down o
                                            dp[num-1][row][col-1] + \
                                            v[row][col],  # right o
                                            )
    print(dp[3][r][c])


if __name__ == '__main__':
    main()

### FIXED CODE ###

def next_line():
    return input()


def next_int():
    return int(input())


def next_int_array_one_line():
    return list(map(int, input().split()))


def next_int_array_multi_lines(size):
    return [int(input()) for _ in range(size)]


def next_str_array(size):
    return [input() for _ in range(size)]


def main():
    r, c, k = map(int, input().split())
    dp = [[[0] * (c+1) for i in range(r+1)] for i in range(4)]
    v = [[0] * (c+1) for i in range(r+1)]
    for i in range(k):
        row, col, val = map(int, input().split())
        v[row][col] = val

    for row in range(1, r + 1):
        for col in range(1, c + 1):
            for num in range(0, 4):
                if num == 0:
                    dp[num][row][col] = dp[3][row-1][col]  # simple down
                else:
                    dp[num][row][col] = max(dp[num-1][row][col],  # str
                                            dp[num][row][col-1],  # right x
                                            dp[3][row-1][col] + \
                                            v[row][col],  # down o
                                            dp[num-1][row][col-1] + \
                                            v[row][col],  # right o
                                            )
    print(dp[3][r][c])


if __name__ == '__main__':
    main()
a,b=map(int,input().split()):print(min(a+b,a-b,a*b))

### FIXED CODE ###

a,b=map(int,input().split());print(max(a+b,a-b,a*b))
f=lambda(x):x%3==0
a,b=map(int,input().split())
print(['Impossible','Possible'][f(a)or f(b)or f(a+b)])

### FIXED CODE ###

f=lambda x:x%3==0
a,b=map(int,input().split())
print(['Impossible','Possible'][f(a)or f(b)or f(a+b)])
import sys
n,m=map(long,input().split())
if n==1:
    print(m)
    sys.exit()
ans=[]
i=1
while i<=m/i:
    if m%i:
        i=i+1
    else:
        j=m/i
        if j>=n:
            ans.append(i)
        if i>=n:
            ans.append(j)
        i=i+1
ans.sort()
print(ans[len(ans)-1])

### FIXED CODE ###

import sys
n,m=map(int,input().split())
if n==1:
    print(m)
    sys.exit()
ans=[]
i=int(1)
while i<=m/i:
    if m%i!=0:
        i+=1
    elif m%i==0:
        j=int(m/i)
        if j>=n:
            ans.append(i)
        if i>=n:
            ans.append(j)
        i+=1
ans.sort()
print(ans[len(ans)-1])
N = int(input())

if N % 2 = 0:
  print(N)
else:
  print(N+1)
  

### FIXED CODE ###

n=int(input())

ans=int(n/2)

if n%2==0:
    print(ans)
else:
    print(ans+1)
while 1:
  h,w = map(int, raw_input().split())
    if h==w==0:
      break

  for i in range(0,h/2):
    print ("#." * (w/2) + "#" * (w%2))
    print (".#" * (w/2) + "." * (w%2))

  if h % 2 == 1:
    print ("#." * (w/2) + "#" * (w%2))

  print "\n"

### FIXED CODE ###

while 1:
  h,w = map(int, raw_input().split())
  if h==w==0:
    break

  for i in range(0,h/2):
    print ("#." * (w/2) + "#" * (w%2))
    print (".#" * (w/2) + "." * (w%2))

  if h % 2 == 1:
    print ("#." * (w/2) + "#" * (w%2))

  print ""
import sys
 
sys.setrecursionlimit(10 ** 6)
INF = float("inf")
MOD = 10 ** 9 + 7
 
 
def input():
    return sys.stdin.readline().strip()
 
 
def main():
    N, M = map(int, input().split())
    dp = [0] * (N + 1)
    safe = [True] * (N + 1)
    for _ in range(M):
        a = int(input())
        safe[a] = False
 
    dp[0] = 1
    for i in range(1, N + 1):
        if i == 1 and safe[i]:
            dp[i] = dp[i - 1]
        else:
            if safe[i]:
                dp[i] = dp[i - 1] + dp[i - 2]
                dp[i] %= MOD
 
    print(dp[-1])
 
 
if __name__ == "__main__":
    main()

### FIXED CODE ###

p, q, r = map(int, input().split())
print(min(p+q, min(q+r, r+p)))
N= raw_input( "N : ")
X= raw_input( "X : ")
T= raw_input( "T : ")
if(N % X == 0):
    print((N // X) * T)
else:
    print(((N // X) *T) + T)

### FIXED CODE ###

N,X,T = map(int, input().split())
if(N % X == 0):
    print((N // X) * T)
else:
    print(((N // X) *T) + T)