Harryxun/stf_run huggingface dataset:
K = int(input())

dp = [-1] * (10 ** 5 + 10)
dp[1] = 1
runrun = []
for i in range(1, len(dp) - 1):
    if len(str(i)) == 1:
        dp[i + 1] = i
        runrun += [i]
        continue
    s = str(i)
    last = int(s[-1])
    upper = s[:-1]
    upper = int(upper)
    if dp[upper + 1] != -1 and (
        dp[upper + 1] == last - 1 or dp[upper + 1] == last or dp[upper + 1] == last + 1
    ):
        dp[i + 1] = last
        runrun += [i]

# print(runrun[:30])
print(runrun[K - 1])


### FIXED CODE ###

K = int(input())

lunlun = [i for i in range(1, 10)]

p = 0


def genelate_lunlun(p):
    last = p % 10
    if last > 0:
        yield p * 10 + last - 1
    yield p * 10 + last
    if last + 1 < 10:
        yield p * 10 + last + 1


while len(lunlun) <= K:
    for new in genelate_lunlun(lunlun[p]):
        lunlun.append(new)
    p += 1

# print(lunlun)
print(lunlun[K - 1])
for i in range(100):
    if a%i==0 and b%i==0:
        cnt += 1
    if cnt == k:
        print(i)
        break

### FIXED CODE ###

a, b, k = map(int, input().split())
cnt = 0
for i in reversed(range(1, 101)):
    if a%i==0 and b%i==0:
        cnt += 1
        if cnt == k:
            print(i)
            break
a,b = = map(int,input().split())
if a==1 and b!=1 or a>b:
  print('Alice')
elif b==1 and a!=1 or b>a:
  print('Bob')
else:
  print('Draw')

### FIXED CODE ###

a,b = map(int,input().split())
if a==b:
  print('Draw')
elif a==1 or b!=1 and a>b:
  print('Alice')
else:
  print('Bob')
sn = int(input())
S = [0 for i in range(sn)]
S = input().split()
for i in range(sn):
	S[i] = int(S[i])

tn = int(input())
T = [0 for i in range(tn)]
T = input().split()
for i in range(tn):
	T[i] = int(T[i])

A=[]
cnt=0

for i in range(tn):

	key=T[i]
	left=0
	right=sn

	while left<right:

		mid=(int)((left+right)/2)

		if S[mid]==key:
			if T[i] not in A:
				cnt+=1
		    	A.append(key)
			break

		if S[mid]>key:
			right=mid
			
		if S[mid]<key:
			left=mid+1


print(cnt)


### FIXED CODE ###


sn = int(input())
S = [0 for i in range(sn)]
S = input().split()
for i in range(sn):
	S[i] = int(S[i])

tn = int(input())
T = [0 for i in range(tn)]
T = input().split()
for i in range(tn):
	T[i] = int(T[i])


cnt=0

for i in range(tn):

	key=T[i]
	left=0
	right=sn
	c=0

	while left<right:

		mid=(int)((left+right)/2)

		if S[mid]==key:
			if c==0:
				cnt+=1
				c=1
				
			break

		if S[mid]>key:
			right=mid

		if S[mid]<key:
			left=mid+1


print(cnt)
import math
a, b, c, d = map(int, input().split())
s = b - a + 1

def dev(x):
    if a % x == 0:
        return b // x - a // x + 1
    return b // x - a // x

print(s - (dev(c) + dev(d) - dev(c * d // math.gcd(c, d))))


### FIXED CODE ###

from fractions import gcd
a, b, c, d = map(int, input().split())
s = b - a + 1

def dev(x):
    if a % x == 0:
        return b // x - a // x + 1
    return b // x - a // x

g = gcd(c, d)
print(s - (dev(c) + dev(d) - dev(c * d // g)))
n,q = [int(x) for x in input().split()]
s = input()
lst = []
for _ in range(q):
    l,r = [int(x) for x in input().split()]
    lst.append([l,r])

cnt = 0
for i in range(q):
    for x in range(lst[i][0]-1, lst[i][1]):
        if s[x] == "A" and s[x+1] == "C":
            if x+1 < lst[i][1]:
                cnt += 1
    print(cnt)
    cnt = 0

### FIXED CODE ###

n,q = [int(x) for x in input().split()]
s = input()

t = [0]*(n+1)
for i in range(n):
    t[i+1] = t[i] + (1 if s[i:i+2] == "AC" else 0)

for _ in range(q):
    l,r = [int(x) for x in input().split()]
    print(t[r-1]-t[l-1])
from collections import Counter
N, K = map(int, input().split())
A = list(map(int ,input().split()))

d = Counter(A)
d.most_common()
n =len(d)
ans = 0
if n <= K:
    print(0)
    exit()
else:
    for i in range(K,n):
        ans += d[i][1]
print(ans)

### FIXED CODE ###

from collections import defaultdict
N, K = map(int, input().split())
A = list(map(int ,input().split()))

d = defaultdict(int)
for i in A:
    d[i] += 1

d_ = sorted(d.items(), key=lambda x:x[1], reverse=True)
n =len(d_)
ans = 0
if n <= K:
    print(0)
    exit()
else:
    for i in range(K,n):
        ans += d_[i][1]
print(ans)
N, K = map(int, input().split(' '))
if 2N < K:
    print(N)
else:
    a = N // K
    print(min(abs(N - a * K), abs(N - a * (K + 1))))

### FIXED CODE ###

N, K = map(int, input().split(' '))
if 2 * N < K:
    print(N)
else:
    a = N // K
    mm = min(abs(N - a * K), abs(N - (a + 1) * K))
    print(mm)
H = input()
A = input()
count = 0


while H > 0:
    H -= A
    count +=1
else:
    print(count)

### FIXED CODE ###

H,A = map(int,input().split())


count = 0

while H > 0:
    H -= A
    count +=1

print(count)
n, k = map(int, input().split())
array = list(map(int, input().split()))
count = [0] * n
from collections import Counter
lis = sorted((Counter(array)).items(), key = lambda x: x[1])
count2 = 0
for i in range(len(lis)):
    if len(lis) > k:
        count2 += lis[i][1]
        lis.remove(lis[i])
print(count2)

### FIXED CODE ###

import collections
n, k = map(int, input().split())
d = collections.defaultdict(int)
b = map(int, input().split())
for e in b:
    d[e] += 1
ret = 0
a = sorted([v for v in d.values()], reverse = True)
while len(a) > k:
    ret  += a.pop()
print(ret)
import numpy as np


def main():
    h, w = map(int, input().split())
    grid = [input() for _ in range(h)]
    field = np.array([[0] * w for _ in range(h)])

    for i, row in enumerate(grid):
        row = row + "#"
        cnt = row.count("#")

        idx = -1
        for j in range(cnt + 1):
            idx_next = row.find("#", idx + 1)
            field[i][idx+1:idx_next] = idx_next - idx - 1
            idx = idx_next

    m = 0
    field = field.T
    grid_t = zip(*grid)

    for i, row in enumerate(grid_t):
        row = "".join(row) + "#"
        cnt = row.count("#")

        idx = -1
        for j in range(cnt + 1):
            idx_next = row.find("#", idx + 1)
            field[i][idx+1:idx_next] += idx_next - idx - 1
            idx = idx_next
        if max(field[i]) > m:
            m = max(field[i])

    print(m - 1)


if __name__ == "__main__":
    main()


### FIXED CODE ###

def main():
    h, w = map(int, input().split())
    grid = [input() for _ in range(h)]
    field = [[0] * w for _ in range(h)]

    for i, row in enumerate(grid):
        row = row + "#"
        cnt = row.count("#")
        idx = -1
        for j in range(cnt + 1):
            idx_next = row.find("#", idx + 1)
            for k in range(idx + 1, idx_next):
                field[i][k] = idx_next - idx - 1
            idx = idx_next

    m = 0
    for i, row in enumerate(zip(*grid)):
        row = "".join(row) + "#"
        cnt = row.count("#")
        idx = -1
        for j in range(cnt + 1):
            idx_next = row.find("#", idx + 1)
            for k in range(idx + 1, idx_next):
                field[k][i] += idx_next - idx - 1
                if field[k][i] > m:
                    m = field[k][i]
            idx = idx_next
    print(m - 1)


if __name__ == "__main__":
    main()
def gcd(a,b) :
    while b :
        a,b = b, a % b
    return a

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

p = 10**9
for i in range(N-1) :
    q = gcd(L[i],L[i+1])
    if q < p :
        p = q

if (K % p ==  0) and (K <= max(L))
    ans = "POSSIBLE"
else :
    ans = "IMPOSSIBLE"
print(ans)


### FIXED CODE ###

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

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

if len(L) == 1 :
    if L[0] == K :
        ans = "POSSIBLE"
    else :
        ans = "IMPOSSIBLE"

else :
    for i in range(N-1) :
        q = gcd(L[i],L[i+1])
        if i == 0 :
            p = gcd(L[i],L[i+1])
        if q < p :
            p = q

    if (K % p ==  0) and (K <= max(L)) :
        ans = "POSSIBLE"
    else :
        ans = "IMPOSSIBLE"
print(ans)
from math import sqrt, floor
import sys

N, M = map(int, input().split())
rootM = floor(sqrt(M))

for m in reversed(range(rootM)):
    if M % m == 0:
        if M // m >= N:
            print(m)
            sys.exit()

### FIXED CODE ###

from math import sqrt, floor
 
N, M = map(int,input().split())
 
rootM = floor(sqrt(M))
l = []
for i in range(1, rootM +1):
    if M % i == 0:
        l.append(i)
        l.append(M//i)
        
ans = 1
for li in l:
    ans = max(ans, li) if li <= M // N else ans
print(ans)
N = int(input())
X = list(map(int, input().split()))
for p in range(1, max(X)):
    for x in X:
        x_sum=0
        x_sum+=(x-p)**2
    ans = min(ans, x_sum)
print(ans)

### FIXED CODE ###

N = int(input())
X = list(map(int, input().split()))
ans = float("inf")
for p in range(1, max(X)+1):
    x_sum=0
    for x in X:
        x_sum+=(x-p)**2
    ans = min(ans, x_sum)
print(ans)
import math
A,B,C,D = map(int,input().split())
K = B-A+1
E = (C*D)//math.gcd(C,D)
c = B//C - (A-1)//C
d = B//D - (A-1)//D
e = B//E - (A-1)//E
print(K-c-d+e)

### FIXED CODE ###

import fractions
A,B,C,D = map(int,input().split())
K = B-A+1
E = (C*D)//fractions.gcd(C,D)
c = B//C - (A-1)//C
d = B//D - (A-1)//D
e = B//E - (A-1)//E
print(K-c-d+e)
s=str(input())
t=len(s)
if s[t]=='s':
  print(s+'es')
else:
  print(s+'s')

### FIXED CODE ###

s=str(input())
t=len(s)
if s[t-1]=='s':
  print(s+'es')
else:
  print(s+'s')
n=int(input())
a=[int(0)]*n
l=list(map(int,input.().split()))
for i in range(n-1):
	a[l[i]] = a[l[i]] + 1
for i in range(n):
	print(a[i])
    

### FIXED CODE ###

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

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

a.sort()
i=0
ans=0

while x>0:
    if x-a[i]>=0:
        x-=a[i]
        ans+=1
    else:
        x=0
    i+=1

print(ans)

### FIXED CODE ###

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

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

a.sort()
i=0
ans=0

while x>0 and i<n:
    if x-a[i]>=0:
        x-=a[i]
        ans+=1
    else:
        x=0
    if i==n-1:
        if x>0:
            ans-=1
    i+=1

print(ans)
n, m = map(int,input().split())
dic = {}
for _ in range(m):
    s,c = map(int,input().split())
    if s not in dic.keys():
        dic[s-1] = c
    elif s in dic.keys() and dic[s-1] !=c:
        res = -1
        break
for i in range(n):
    if i not in dic.keys():
        dic[i] = 0

if dic[0] ==0:
    res = -1
if res == -1:
    print('-1')
    exit()
ls = []
for i in range(n):
    ls.append(str(dic[i]))
ans = ''.join(ls)
print(ans)


### FIXED CODE ###

n, m = map(int,input().split())
dic = {}
ans = 0
for _ in range(m):
    s,c = map(int,input().split())
    if s-1 not in dic.keys():
        dic[s-1] = c
    if s-1 in dic.keys() and dic[s-1] !=c:
        ans = -1
        break
    if s == 1 and c == 0 and n!=1:
        ans = -1
        break
if ans == -1:
    print(ans)
    exit()
if 1 not in dic.keys() and n !=1:
    dic[1] = 0
if 2 not in dic.keys() and n ==3:
    dic[2] = 0  
if 0 not in dic.keys() and n!=1:
    dic[0] = 1
if 0 not in dic.keys() and n==1:
    dic[0] = 0
ls = []
for i in range(n):
    ls.append(str(dic[i]))
ans = ''.join(ls)
print(ans)
N = int(input())
A = int(input())
B = int(input())

if N == 1:
    print("Hello World")
else:
    print(A+B)


### FIXED CODE ###

N = int(input())


if N == 1:
    print("Hello World")
else:
    A = int(input())
    B = int(input())
    print(A+B)
import functools as ft
x,n = map(int, input().split())
l = map(lambda t : int(t)-x, input().split())
p = sorted(map(abs,l))
for i in range((n//2)+1):
    if not ( p[i] == p[i+1] ==i ):
        if -i in l:
            print(x+i)
        else:
            print(x-i)

### FIXED CODE ###

x,n,*p=map(int,open(0).read().split())
print(min({*range(999)}-{*p},key=lambda y:abs(y-x)))
H, W = map( int, input().split() )
s = [ [ map( str, input().split() ) ] for i in range(H) ] 
for i in range(H) : 
    for j in range(W) : 
       if "snuke" in s[i][j] : 
           w = chr( i + ord( "A" ) )
           h = i + 1
           exit()
print( w + str( h ) )

### FIXED CODE ###

H, W = map( int, input().split() )
s = [ list( map( str, input().split() ) ) for i in range(H) ] 
for i in range(H) : 
    for j in range(W) : 
       if s[i][j] == "snuke" : 
           w = chr( j + ord( "A" ) )
           h = i + 1
           print( w + str( h ) )
           exit()
x = int(input())
num = 0
for i in range(1,1e6):
    num += i
    if num >= x:
        print(i)
        exit() 

### FIXED CODE ###

x = int(input())
num = 0
for i in range(1,1000000):
    num += i
    if num >= x:
        print(i)
        exit()
H,A = map(int, input())
for i in range(H):
   H = H-4
   i += 1
   if H<= 0:
      break
print(i)

### FIXED CODE ###

h, a = map(int, input().split())

i = 0

while h > 0:
    h = h - a
    i += 1

print(i)
import sys
sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N,M = map(int,readline().split())
A = [True] * (N+10)
MOD = 10 ** 9 + 7
for _ in range(M):
  x = int(readline())
  A[x] = False


DP = [0] * (N+10)
DP[0] = 1

for i in range(N):
  if not A[i]:
    continue
  
  if A[i+1]:
    DP[i+1] += DP[i]
    DP[i+1] %= MOD
  if A[i+2]:
    DP[i+2] += DP[i]
    DP[i+2]: %= MOD
       
print(DP[N]%MOD)
      
  




### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N,M = map(int,readline().split())
A = [True] * (N+10)
MOD = 10 ** 9 + 7
for _ in range(M):
  x = int(readline())
  A[x] = False


DP = [0] * (N+10)
DP[0] = 1

for i in range(N):
  if not A[i]:
    continue
  
  if A[i+1]:
    DP[i+1] += DP[i]
    DP[i+1] %= MOD
  if A[i+2]:
    DP[i+2] += DP[i]
    DP[i+2] %= MOD
       
print(DP[N]%MOD)
N = int(input())
memo = [{} for _ in range(N + 1)]

def ok(last4):
  for i in range(4):
    s = list(last4)
    if i >= 1:
      s[i - 1]. s[i] = s[i], s[i - 1]
    if "".join(s).count("AGC") >= 1:
      return False
    return True

def dfs(last3, n):
  if last3 in memo[n]:
    return memo[n][last3]
  if n == N:
    return 1
  ret = 0
  for c in "AGCT":
    if ok(last3 + c):
      ret += dfs(last3[1:] + c, n + 1) % (10 ** 9 + 7)
  memo[n][last3] = ret
  return ret

print(dfs("TTT", 0))

### FIXED CODE ###

b = input()
if b == "A":
  print("T")
elif b == "C":
  print("G")
elif b == "G":
  print("C")
else:
  print("A")
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
index = int(input().split())
print(a[index-1])

### FIXED CODE ###

a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
index = int(input()) -1
print(a[index])
n = raw_input()

a = n.split()

b = a[0] * a[1]

c = (a[0] + a[1]) * 2

print b , c

### FIXED CODE ###

n = raw_input()

a = n.split(" ")

b = int(a[0])

c = int(a[1])

print b * c , (b + c) * 2
N,X,T=[int(i) fir i in input().split()]
a=divmod(N,X)
x=a[0]
if a[1]<X and a[1] != 0:
  x += 1
print(x*T)

   

### FIXED CODE ###

N,X,T=[int(i) for i in input().split()]
a=divmod(N,X)
x=a[0]
if a[1]<X and a[1] != 0:
  x += 1
print(x*T)
#!/usr/bin/env python
# coding: utf-8

# In[129]:


import math


# In[124]:


A, B, C, D = map(int, input().split())


# In[130]:


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


# In[131]:


c_part_a = int((A - 1) / C)
d_part_a = int((A - 1) / D)
cd_part_a = int((A - 1) / lcm)

c_part_b = int(B / C)
d_part_b = int(B / D)
cd_part_b = int(B / lcm)


# In[132]:


ans1 = (A-1) - (c_part_a + d_part_a - cd_part_a)
ans2 = B - (c_part_b + d_part_b - cd_part_b)


# In[133]:


print(ans2 - ans1)


# In[ ]:






### FIXED CODE ###

#!/usr/bin/env python
# coding: utf-8

# In[8]:


import math


# In[5]:


A,B,C,D = map(int, input().split())


# In[14]:


ac = (A-1)//C
bc = B//C
ad = (A-1)//D
bd = B//D
a_both = (A-1)//(C*D//math.gcd(C,D))
b_both = B//(C*D//math.gcd(C,D))
print((B-A+1) - (bc-ac) - (bd-ad) + (b_both-a_both))


# In[ ]:
k,x=map(int,input().split())
for i in range(k)
	print(x+i-k+1,end="")
if k!=1:
	print(" ",end="")
	for i in range(k)[1:]
    	print(x+i,end="")
    

### FIXED CODE ###

k,x=map(int,input().split())
for i in range(k):
	print(x+i-k+1,end=" ")
if k != 1:
	print("",end="")
	for s in range(k)[1:]:
		print(x+s,end=" ")
m = input()
n = 48 - m
print(n)


### FIXED CODE ###

m = int(input())
n = 48 - m
print(n)
n,k=map(int,input().split())
s=0
l=list(map(int,input().split()))
c=0
i=0
while(s<=k):
    s+=l[i]
    i+=1
    c+=1
print(c)


### FIXED CODE ###

n,k=map(int,input().split())
s=0
l=list(map(int,input().split()))
c=1
for i in range(n):
    s+=l[i]
    if(k<s):
        break
    c+=1
print(c)
n=input()
h = list(map(int,input().split()))
h1 = h[0]
hi = h[-1]
hi2 = h[-2]
count = 0
ans = [count + 1 for t in h if t >= h1]
if hi2 > hi and hi2 >= h1:
    ans -= 1
print(count)

### FIXED CODE ###

a,b = map(int,(input().split()))
if a == b:
    ans = a*2
    print(ans)
else:
    big = max(a,b)
    ans = big + (big-1)
    print(ans)
N=int(input())
if N<2:
    x=1
elif N<4:
    x=2
elif N<8:
    x=4
elif N<16:
    x=8
elif n<32:
    x=16
elif n<64:
    x=32
else:
    x=64
print(x)

### FIXED CODE ###

N=int(input())
if N<2:
    x=1
elif N<4:
    x=2
elif N<8:
    x=4
elif N<16:
    x=8
elif N<32:
    x=16
elif N<64:
    x=32
else:
    x=64
print(x)
def main():
    N = int(input())
    red = []
    for i in range(N):
        x,y = [int(i) for i in input().split()]
        red.append([x,y])
    blue = []
    for i in range(N):
        x,y = [int(i) for i in input().split()]
        blue.append([x,y])
    red.sort(reverse=True)
    blue.sort(reverse=True)
    #print(red)
    #print(blue)
    pair = 0
    for a in range(N):
        flag = False
        for i in range(N):
            for j in range(N):
                if(red[i][0] <= blue[j][0] and red[i][1] <= blue[j][1]):
                    pair = pair + 1
                    flag = True
                    #print(f'{red[i]} {blue[j]}')
                    blue[j][0] = -10000000000
                    blue[j][1] = -10000000000
                    break
                
        if flag:
            break
    print(pair)
if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    A,B,C =list(map(int,input().split()))
    if(C <=(A+B)):
        print("Yes")
    else:
        print("No")



if __name__ == '__main__':
    main()
x, a = map(int, input())
if x < a:
    print(0)
else:
    print(10)


### FIXED CODE ###

x, a = map(int, input().split())
if x < a:
    print(0)
else:
    print(10)
def sunuke_f3(n, m) :
    if n >= m :
        return(m//2)
    else :
        if 2*n < m :
            return(n + (m-2*n)//4)
        else :
            return(m//2)
sunuke_f3(N, M)

### FIXED CODE ###

N, M = map(int, input().split(' '))
def sunuke_f3(n, m) :
    if n >= m :
        return(m//2)
    else :
        if 2*n < m :
            return(n + (m-2*n)//4)
        else :
            return(m//2)
print(sunuke_f3(N, M))
N, Y = map(int, input().split())
for i1 in range(0,N)
	for i2 in range(0,N-i1)
  		if N-i1<0
    		break
  		for i3 in range(0,N-i1-i2)
        	if N-i1-i2<0
          		break
    		if Y==10000*i1+5000*i2+1000*i3:
        		print(i1,i2,i3)
          		break
            else:
        else:
    else:
else:

### FIXED CODE ###

N, Y = map(int, input().split())
 
for x in range(N+1):
  for y in range(N-x+1):
    z = N - x - y
    if 10000 * x + 5000 * y + 1000 * z == Y:
      print(x,y,z)
      exit()
print(-1,-1,-1)
import sys
H,W=map(int,input().split())
listA=[list(input()) for i in range(H)]
start=[0,0]
while 1:
  if start==[H-1,W-1]:
    print("Possible")
    sys.exit()
  if start[1]==W-1 and start[0]!=H-1:
    print("Impossible")
    sys.exit()
  if start[0]!=H-1 and listA[start[0]+1][start[1]]=="#" and listA[start[0]][start[1]+1]=="#":
    print("Impossible")
    sys.exit()
  if start[0]!=0 and start[1]!=0 and listA[start[0]+1][start[1]]=="#" and listA[start[0]][start[1]-1]=="#" and listA[start[0]-1][start[1]]=="#":
    print("Impossible")
    sys.exit()
  if start[0]!=H-1 and listA[start[0]+1][start[1]]=="#":
    start=[start[0]+1,start[1]]
    continue  
  if listA[start[0]][start[1]+1]=="#":
    start=[start[0],start[1]+1]    
  else:
    print("Impossible")

### FIXED CODE ###

import sys
H,W=map(int,input().split())
listA=[list(input()) for i in range(H)]
start=[0,0]
while 1:  
  if start[0]!=H-1 and start[1]!=W-1 and listA[start[0]+1][start[1]]=="#" and listA[start[0]][start[1]+1]=="#":
    print("Impossible")
    sys.exit()
  if start[0]!=0 and start[1]!=0 and listA[start[0]-1][start[1]]=="#" and listA[start[0]][start[1]-1]=="#":
    print("Impossible")
    sys.exit()
  if start==[H-1,W-1]:
    print("Possible")
    sys.exit()  
  if start[0]!=H-1 and listA[start[0]+1][start[1]]=="#":
    start=[start[0]+1,start[1]]
    continue  
  if start[1]!=W-1 and listA[start[0]][start[1]+1]=="#":
    start=[start[0],start[1]+1]    
  else:
    print("Impossible")
xs[5] = []
for i in range(5):
  xs.append(int(input()))
  if not xs[i] = i:
    print i
    break


### FIXED CODE ###

xs = [int(e) for e in input().split()]
for i in range(5):
  if not xs[i] == i+1:
    print(i+1)
    break
N = int(input())
A = list(map(int,input().split()))
B = [0]
tmp = 0
for a in A:
    tmp += a
    B.append(tmp)

l = 1
r = 3
cut = []
for i in range(2,N-1):
    Lm = float("inf")
    Rm = float("inf")
    c = [0,i,0]
    for j in range(l,i):
        tmp = abs(B[i]-2*B[j])
        if tmp > Lm:
            c[0] = j-1
            l = j-1
            break
        Lm = tmp
    else:
        c[0] = i-1
        l = i-1
    for k in range(r,N):
        tmp = abs((B[N]-B[k])-(B[k]-B[i]))
        if tmp > Rm:
            c[2] = k-1
            r = k-1
            break
        Rm = tmp
    else:
        c[2] = N-1
        r = N
    cut.append(c)
p#rint(cut)
ans = float("inf")
for p,q,r in cut:
    P = B[p]
    Q = B[q]-B[p]
    R = B[r]-B[q]
    S = B[N]-B[r]
    ans = min(ans,max(P,Q,R,S)-min(P,Q,R,S))
print(ans)


### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
B = [0]
tmp = 0
for a in A:
    tmp += a
    B.append(tmp)

l = 1
r = 3
cut = []
for i in range(2,N-1):
    Lm = float("inf")
    Rm = float("inf")
    c = [0,i,0]
    for j in range(l,i):
        tmp = abs(B[i]-2*B[j])
        if tmp > Lm:
            c[0] = j-1
            l = j-1
            break
        Lm = tmp
    else:
        c[0] = i-1
        l = i-1
    for k in range(r,N):
        tmp = abs((B[N]-B[k])-(B[k]-B[i]))
        if tmp > Rm:
            c[2] = k-1
            r = k-1
            break
        Rm = tmp
    else:
        c[2] = N-1
        r = N
    cut.append(c)
#print(cut)
ans = float("inf")
for p,q,r in cut:
    P = B[p]
    Q = B[q]-B[p]
    R = B[r]-B[q]
    S = B[N]-B[r]
    ans = min(ans,max(P,Q,R,S)-min(P,Q,R,S))
print(ans)
s = input()

if s.count(s[0]) == 2 and s.count(s[1])==2 and s.count(as2])==2:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

s = input()

if s.count(s[0]) == 2 and s.count(s[1])==2 and s.count(s[2])==2:
    print("Yes")
else:
    print("No")
N=int(input())
if N=1:
    print("Hello World")
else:
    A,B=map(int,input().split())
    print(A+B)

### FIXED CODE ###

N=int(input())
if N==1:
    print("Hello World")
else:
    A=int(input())
    B=int(input())
    print(A+B)
a,b=map(int,(input().split()))
li=[]
for i in range(a):
    li.append(input())
li.sort
a=li[0]
for j in range(1,a):
    a+=li[j]
print(a)




### FIXED CODE ###

a,b=map(int,(input().split()))
li=[]
for i in range(a):
    li.append(input())
li2=sorted(li)
c=li2[0]
for j in range(1,a):
    c+=li2[j]
print(c)
S, T = input()
print(T,S)

### FIXED CODE ###

S, T = raw_input().split()
print T+S
import bisect
import math
n = int(input())
l = sorted(list(map(int,input().split())))
a = l[-1]/2
s = bisect.bisect_left(l,a)
k1 = l[s]
if len(l)==2 and l[0]==0:
  print(0)
  exit()

def com(a,b):
  return math.factorial(a)//(math.factorial(b)*math.factorial(a-b))

s1 = com(l[-1],k1)
s2 = com(l[-1],k2)
if s1>=s2:
  print(l[-1],k1)
else:
  print(l[-1],k2)

### FIXED CODE ###

import bisect
import math
n = int(input())
l = sorted(list(map(int,input().split())))
if len(l)==2 :
  print(l[-1],l[-2])
  exit()
  
a = l[-1]/2
s = bisect.bisect_left(l,a)
if l[s]==a:
  print(l[-1],l[s])
  exit()
k1 = l[s-1]
k2 = l[s]
s1 = a-k1
if k2==l[-1]:
  k2 = k1
s2 = abs(k2-a)
#print(s,k1,k2,s1,s2)
if s1<=s2:
  print(l[-1],k1)
else:
  print(l[-1],k2)