Harryxun/stf_run huggingface dataset:
from collections import deque

H,W=map(int,input().split())
H-=1
W-=1
maze=[]
for i in range(H+1):
   S=input()
   S=[c for c in S]
   maze.append(S)

maze[0][0]="S"

count=0
for i in range(H+1):
   for j in range(W+1):
      if maze[i][j]=="#":
         count+=1

que=deque([[0,0]])
steps=[[-1]*(W+1) for i in range(H+1)]
steps[0][0]=0
flag=True

def bfs():
      global flag
      print(que)
      now=que.popleft()
      now_step=steps[now[0]][now[1]]
      for dx,dy in (0,-1),(1,0),(0,1),(-1,0):
            ny=now[0]+dy
            nx=now[1]+dx
            if 0<=ny<=H and 0<=nx<=W:
                  if ny==H and nx==W:
                        print((H+1)*(W+1)-(now_step+1+1)-(count))
                        flag=False
                        break
                  elif maze[ny][nx]==".":
                        maze[ny][nx]="A"
                        que.append([ny,nx])
                        steps[ny][nx]=now_step+1
                  else:
                        pass

while(flag):
      bfs()

### FIXED CODE ###

from collections import deque

H,W=map(int,input().split())
H-=1
W-=1
maze=[]
for i in range(H+1):
   S=input()
   S=[c for c in S]
   maze.append(S)

maze[0][0]="S"

count=0
for i in range(H+1):
   for j in range(W+1):
      if maze[i][j]=="#":
         count+=1

que=deque([[0,0]])
steps=[[-1]*(W+1) for i in range(H+1)]
steps[0][0]=0
flag=True

def bfs():
      global flag
      if len(que)>=1:
         now=que.popleft()
         now_step=steps[now[0]][now[1]]
         for dx,dy in (0,-1),(1,0),(0,1),(-1,0):
               ny=now[0]+dy
               nx=now[1]+dx
               if 0<=ny<=H and 0<=nx<=W:
                     if ny==H and nx==W:
                           print((H+1)*(W+1)-(now_step+1+1)-(count))
                           flag=False
                           break
                     elif maze[ny][nx]==".":
                           maze[ny][nx]="A"
                           que.append([ny,nx])
                           steps[ny][nx]=now_step+1
                     else:
                           pass
      else:
         print(-1)
         flag=False

while(flag):
      bfs()
A, B, M = input().split()
A=int(A)
B=int(B)
M=int(M)
a = list(map(int, input().split()))
b = list(map(int, input().split()))
x = [list(map(int, input().split())) for i in range(M)]
 
dis = []
for i in range(M):
    m = x[i][0]-1
    n = x[i][0]-1
    dis.append(a[m] + b[n] - x[i][2])
    
a.sort()
b.sort()
 
dis.append(a[0]+b[0])
 
print(min(dis))

### FIXED CODE ###

A, B, M = input().split()
A=int(A)
B=int(B)
M=int(M)
a = list(map(int, input().split()))
b = list(map(int, input().split()))
x = [list(map(int, input().split())) for i in range(M)]
 
dis = []
for i in range(M):
    m = x[i][0]-1
    n = x[i][1]-1
    dis.append(a[m] + b[n] - x[i][2])
    
a.sort()
b.sort()
 
dis.append(a[0]+b[0])
 
print(min(dis))
A,B,K=map(int,input().split())
list=[]
for i in range(1,min(A,B)):
  if A%i==0 and B%i==0 :
    list.append(i)
print(list[len(list)-K+1])

### FIXED CODE ###

A,B,K=map(int,input().split())
list=[]
for i in range(1,min(A,B)+1):
  if A%i==0 and B%i==0 :
    list.append(i)
print(list[len(list)-K])
import itertools


def solve():
    N = int(input())
    A = list(map(int, input().split(" ")))
    B = list(map(int, input().split(" ")))
    C = list(map(int, input().split(" ")))

    cnt = 0
    for ele in list((itertools.product(A, B, C))):
        if ele[0] < ele[1] < ele[2]:
            cnt += 1

    print(cnt)

 
solve()

### FIXED CODE ###

def solve():
    c1 = list(input())
    c2 = list(input())
    c2.reverse()
    if c1 == c2:
        print("YES")
    else:
        print("NO")



solve()
a=input();
b=input();
if a<b:
    print(0);
else:
    print(10);

### FIXED CODE ###

x,a=map(int,input().split())
if x<a:
    print(0)
else:
    print(10)
import sys
def input():
    return sys.stdin.readline()[:-1]

H,W,K = map(int,input().split(' '))
l = [list(input()) for _ in range(H)]

MAP = [None]*H
for i in range(H):
    MAP[i] = [None]*W

cnt = 1
dp = []
for i in range(H):
    all_white_f = True
    flag = True
    for j in range(W):
        k = l[i][j]
        if k=='#':
            if not flag:
                cnt += 1
            all_white_f = False
            flag = False
        MAP[i][j] = str(cnt)
    if all_white_f:
        MAP[i] = None
        dp.append(i)
        cnt -= 1
    cnt += 1
pre = -1
tmp = []
f = True
if len(dp)==0:
    print(MAP)
    exit()
if dp[0]==0:
    for i in dp:
        if i-pre==1:
            tmp.append(i)
            pre = i
        else:
            if f:
                for j in tmp:
                    first = tmp[-1]+1
                    MAP[j] = MAP[first]
            MAP[i] = MAP[i-1]
else:
    for i in dp:
        MAP[i] = MAP[i-1]
for i in range(H):
    print(' '.join(MAP[i]))

### FIXED CODE ###

import sys,itertools
def input():
    return sys.stdin.readline()[:-1]

H,W,K = map(int,input().split(' '))
l = [list(input()) for _ in range(H)]

MAP = [None]*H
for i in range(H):
    MAP[i] = [None]*W

cnt = 1
dp = []
for i in range(H):
    all_white_f = True
    flag = True
    for j in range(W):
        k = l[i][j]
        if k=='#':
            if not flag:
                cnt += 1
            all_white_f = False
            flag = False
        MAP[i][j] = str(cnt)
    if all_white_f:
        MAP[i] = None
        dp.append(i)
        cnt -= 1
    cnt += 1
pre = -1
tmp = []

if len(dp)==0:
    for i in range(H):
        print(' '.join(MAP[i]))
    exit()


if dp[0]==0:
    for i in dp:
        if i-pre==1:
            tmp.append(i)
            pre = i
        else:
            if len(tmp)!=0:
                for j in tmp:
                    first = tmp[-1]+1
                    MAP[j] = MAP[first]
                tmp = []
            MAP[i] = MAP[i-1]
    if len(tmp)!=0:
        for j in tmp:
            first = tmp[-1]+1
            MAP[j] = MAP[first]
else:
    for i in dp:
        MAP[i] = MAP[i-1]
for i in range(H):
    print(' '.join(MAP[i]))
N=int(input())
A=list(map(int,input().split()))
 
for i in range(N-1,0,-1) :
    if A[i-1]>A[i] :
        if A[i]<A[i+1] :
            continue
        A.pop(i)
 
if len(A)==1 :
    print(1000)
    exit()

n=len(A)
money=1000
kabu=0
 
 
for i in range(n-1) : 
    if i==n-2 :
        if A[i-1]<=A[i] :
            continue
        elif A[i-1]>A[i] :
            kabu+=money//A[i]
            money-=A[i]*(money//A[i])
 
    if A[i]<A[i+1] and money>=A[i] : #株を買う
        kabu+=money//A[i]
        money-=A[i]*(money//A[i])
 
    elif A[i]>A[i+1] and kabu>0 :    #株を売る
        if A[i+1]>=A[i+2] :          #下がり続けていれば何もしない
            continue
        elif A[i+1]<A[i+2] :
            money+=kabu*A[i]
            kabu=0
 
else :
    money+=kabu*A[n-1]
    print(money)
    

### FIXED CODE ###

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

money=1000
stock=0

for i in range(N-1) :
    if A[i]<A[i+1] :
        stock=money//A[i]
        money-=stock*A[i]
        money+=stock*A[i+1]

    else :
        continue

print(money)
n, k = (int(i) for i in input().split()) 

a = 0
b = 0
for i in range(1, n):
	a = a +i
for i in range(1, (n -k)):
	b = b + i
	
print(a/b)

### FIXED CODE ###

n, k = (int(i) for i in input().split()) 
a =  n - k + 1
print( a)
n = input()
A = list(map(int, input().split())
print(int(max(A))-int(min(A)))

### FIXED CODE ###

n = input()
A = list(map(int, input().split()))
print(int(max(A)) - int(min(A)))
g2 = [4, 6, 9, 11]
g3 = [2]

s = map(int, raw_input().split())

x = s[0]
y = s[1]

if (x in g1) and (y in g1):
    print "Yes"
elif (x in g2) and (y in g2):
    print "Yes"
elif (x in g3) and (y in g3):
    print "Yes"
else:
    print "No"

### FIXED CODE ###

g1 = [1, 3, 5, 7, 8, 10, 12]
g2 = [4, 6, 9, 11]
g3 = [2]

s = map(int, raw_input().split())

x = s[0]
y = s[1]

if (x in g1) and (y in g1):
    print "Yes"
elif (x in g2) and (y in g2):
    print "Yes"
elif (x in g3) and (y in g3):
    print "Yes"
else:
    print "No"
from sys import stdin
from collections import deque
input = stdin.readline


def main():
    n, m = map(int, input().split())

    nexts = [[] for i in range(n)]
    
    for _ in range(m):
        ai, bi = map(int, input().split())
        ai -= 1
        bi -= 1
        nexts[ai].append(bi)
        nexts[bi].append(ai)

    blues = [m] * n # 1 is in blues
    blues[0] = 0 # 0 is not in blues
    checked = [0] * n

    red_deque = deque([0])

    while m in blues:
        rd = red_deque[0]
        red_deque.popleft()
        if checked[rd] == 0:
            checked[rd] = 1
            for nxt in nexts[rd]:
                if blues[nxt] == m:
                    blues[nxt] = rd
                    red_deque.append(nxt)

    print("Yes")
    for blue in blues[1:]:
        print(blue + 1)
    

if __name__ == "__main__":
    main()

### FIXED CODE ###

from sys import stdin
from collections import deque
input = stdin.readline


def main():
    n, m = map(int, input().split())

    nexts = [[] for i in range(n)]
    
    for _ in range(m):
        ai, bi = map(int, input().split())
        ai -= 1
        bi -= 1
        nexts[ai].append(bi)
        nexts[bi].append(ai)

    blues = [-1] * n # 1 is in blues
    blues[0] = 0 # 0 is not in blues
    checked = [0] * n

    red_deque = deque([0])

    while len(red_deque) > 0:
        rd = red_deque[0]
        red_deque.popleft()
        if checked[rd] == 0:
            checked[rd] = 1
            for nxt in nexts[rd]:
                if blues[nxt] == -1:
                    blues[nxt] = rd
                    red_deque.append(nxt)

    print("Yes")
    for blue in blues[1:]:
        print(blue + 1)
    

if __name__ == "__main__":
    main()
from itertools import accumulate
import math

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

ans = 10**10

sum_list_aaa =list(accumulate(list_aaa))

for i in range(N):
    zen = sum_list_aaa[i]
    go = sum_list_aaa[-1]-sum_list_aaa[i]
    ans = min(ans,abs(zen-go)

print(ans)


### FIXED CODE ###

from itertools import accumulate
import math

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

ans = 10**10

sum_list_aaa =list(accumulate(list_aaa))

for i in range(N):
    zen = sum_list_aaa[i]
    go = sum_list_aaa[-1]-sum_list_aaa[i]
    ans = min(ans,abs(zen-go))

print(ans)
N=(int(input()))//10
if N==2 or N==4 or N==5 or N==7 or N==9:
  print("hon")
elif N==0 or N==1 or N==6 or N==8:
  print("pon")
else:
  print("bon")

### FIXED CODE ###

x,y=map(int,input().split())
print(x*y)
a = [int(input()) for i in range(5)]
n = 0
ans = 0

for x in a:
    if x % 10 != 0:
        t = 10 - x % 10
    else:
        t = 0
        
    res += x + t
    n = max(n, t)
    
print(ans - n)


### FIXED CODE ###

a = [int(input()) for i in range(5)]
n = 0
ans = 0

for x in a:
    if x % 10 != 0:
        t = 10 - x % 10
    else:
        t = 0
        
    ans += x + t
    n = max(n, t)
    
print(ans - n)
i = 0
while True :
  x = int(input())
  if(x is none) :
    break
  else :
    i += 1
    print("Case i:", x)
    


### FIXED CODE ###

i = 0

while True :
    x = int(input())
    if x == 0 :
        break
    else :
        i += 1
        print("Case ", i, ": ", x, sep = "")
c = []
for i in range(3):
  c.append(list(map(int, input()split())))
diff = c[1][2] - c[2][2]
c[1][1] -= diff
c[1][0] -= diff

diff = c[0][2] - c[2][2]
c[0][1] -= diff
c[0][0] -= diff

if c[1][1] == c[2][1] and c[0][1] == c[2][1] and c[1][0] == c[2][0] and c[1][0] == c[0][0]:
  print('Yes')
else:
  print('No')
  


### FIXED CODE ###

c = []
for i in range(3):
  c.append(list(map(int, input().split())))
diff = c[1][2] - c[2][2]
c[1][1] -= diff
c[1][0] -= diff

diff = c[0][2] - c[2][2]
c[0][1] -= diff
c[0][0] -= diff

if c[1][1] == c[2][1] and c[0][1] == c[2][1] and c[1][0] == c[2][0] and c[1][0] == c[0][0]:
  print('Yes')
else:
  print('No')
from math import sqrt
from decimal import Decimal
 
a,b,c = map(int,input().split())
s=c-a-b

if a*b< (S**2)/4:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

from math import sqrt
from decimal import Decimal
 
a,b,c = map(int,input().split())
s=c-a-b

if s>=0:
  if Decimal(4*a*b)< Decimal(s**2):
    print("Yes")
  else:
    print("No")
else:
  print("No")
m1, d1 = int(input())
m2, d2 = int(input())
if m1==m2:
  print("0")
else:
  print("1")

### FIXED CODE ###

m1, d1 = map(int, input().split())
m2, d2 = map(int, input().split())
if m1==m2:
  print("0")
else:
  print("1")
X, K, D = map(int, input().split())

ans_list = []

if X+K*D <= 0:
    ans = abs(X+K*D)
else:
    if D>0:
        a = int((X+K*D)/(2*D))
        for i in range(-2,3):
            if a+i <= K and a+i >= 0:
                #ans_list.append(abs(X+(K-(a+i))*D - (a+i)*D))
                ans_temp = K-2*(a+i)
                ans_list.append(abs(X + ans_temp*D))
        ans = min(ans_list)
print(ans)

### FIXED CODE ###

X, K, D = map(int, input().split())
ans_list = []

if X+K*D <= 0:
    ans = abs(X+K*D)
else:
    a = (X+K*D)//(2*D)
    if a >= K:
        a = K
        ans = abs(X-K*D)
    else:
        ans_1 = abs(X+K*D-2*a*D)
        ans_2 = abs(X+K*D-2*(a+1)*D)
        ans = min(ans_1, ans_2)
print(ans)
n = int(input())
if n % 1000 == 0:
  print(0)
else:
  print(2000-int("1"+str(n[:-3])))

### FIXED CODE ###

n = int(input())
if n % 1000 == 0:
  print(0)
else:
  while n > 1000:
    n -= 1000
  print(1000-n)
r = int(input())
print(2*r*np.pi, (r**2)*np.pi)


### FIXED CODE ###

r = float(input())

pi = 3.141592653589793
print(pi*r**2, 2*pi*r)
print(3 ** int(input())

### FIXED CODE ###

print(int(input()) ** 3)
x=2
print x**3


### FIXED CODE ###

x=int(input())
print(x**3)
import sys, os, math, bisect, itertools, collections, heapq, queue, copy, array

# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
# from decimal import Decimal
# from collections import defaultdict, deque

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N, K = il()
    A = il()
    for n in range(1, N):
        A[n] *= A[n - 1]
        if n == K:
            A[n] //= A[n - K]
        elif n > K:
            A[n] //= A[n - K] // A[n - K - 1]

        if n >= K:
            if A[n - 1] < A[n]:
                print('Yes')
            else:
                print('No')


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys, os, math, bisect, itertools, collections, heapq, queue, copy, array

# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
# from decimal import Decimal
# from collections import defaultdict, deque

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N, K = il()
    A = il()

    for k in range(K, N):
        if A[k - K] < A[k]:
            print('Yes')
        else:
            print('No')


if __name__ == '__main__':
    main()
n = int(input())
LST = [0] * n
for i in range(n):
    p = int(input())
    lst = [[0]*2 for _ in range(p)]
    for j in range(p):
        a, b = list(map(int, input().split()))
        lst[j][0] = a - 1
        lst[j][1] = b
    LST[i] = lst

def checker(bit):
    flag = True
    for i in range(n):
        if not ((bit >> (2-i)) & 1):
            continue
        num = len(LST[i])
        for j in range(num):
            people = LST[i][j][0]
            TF = LST[i][j][1]
            if TF == 0 and ((bit >> (2-people)) & 1) == 1:
                flag = False
            if TF == 1 and ((bit >> (2-people)) & 1) != 1:
                flag = False
    return flag

max_num = 0
for k in range(n ** 2 - 1):
    cnt = 0
    if checker(k):
        for l in range(n):
            if((k >> l) & 1):
                cnt += 1
        if cnt > max_num:
            max_num = cnt

print(max_num)

### FIXED CODE ###

n = int(input())
words_list = [[] for _ in range(n)]
for i in range(n):
    a = int(input())
    for _ in range(a):
        x, y = map(int, input().split())
        words_list[i].append((x - 1, y))

ans = 0
for i in range(2 ** n):
    peoples = []
    flag = True
    for j in range(n):
        if (i >> j & 1):
            peoples.append(1)
        else:
            peoples.append(0)
    for k in range(n):
        if peoples[k] == 1:
            words = words_list[k]
            for word in words:
                if peoples[word[0]] != word[1]:
                    flag = False
                    break
    if flag:
        ans = max(ans, sum(peoples))

print(ans)
A, B = map(int, input())

if A == B:
  print("Draw")
elif A == 1:
  print("Alice")
elif B == 1:
  print("Bob")
elif A > B :
  print("Alice")
else:
  print("Bob")

### FIXED CODE ###

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

if A == B:
  print("Draw")
elif A == 1:
  print("Alice")
elif B == 1:
  print("Bob")
elif A > B :
  print("Alice")
else:
  print("Bob")
if __name__ == '__main__':
    N = int(input())
    if N-90>0:
        print(Yes)
        return
    x = (N-9)/10
    if x == int(x):
        print(Yes)
        return
    print(No)

### FIXED CODE ###

if __name__ == '__main__':
    i = 0
    N = int(input())
    if N-90>0:
        i = 1
    x = (N-9)/10
    if x == int(x):
        i = 1
    if i == 1:
        print('Yes')
    else:
        print('No')
W = []
K = []

for i in range(20):
    W.append(int(input()))

for i in range(20):
    K.append(int(input()))

W.sort(reverse=True)
K.sort(reverse=True)

print(W[0] + W[1] + W[2])
print(K[0] + K[1] + K[2])


### FIXED CODE ###

W = []
K = []

for i in range(10):
    W.append(int(input()))

for i in range(10):
    K.append(int(input()))

W.sort(reverse=True)
K.sort(reverse=True)

print(W[0] + W[1] + W[2] , K[0] + K[1] + K[2])
nums1 = list(map(int,input().split()))
nums2 = list(map(int,input().split()))
nums3 = list(map(int,input().split()))
seen = [nums1[0],nums1[1],nums1[2],nums2[0],nums2[1],nums2[2],nums3[0],nums3[1],nums3[2]]
over = False
N = int(input())
for x in range(N):
  num = int(input())
  if num in seen:
    seen[x] = "O"
if seen[0] == "O":
  if seen[1] == seen[2] == "O":
    print("YES")
    over = True
  elif seen[3] == seen[6] == "O":
    print("YES")
    over = True
  elif seen[4] == seen[8] == "O":
    print("YES")
    over = True
elif seen[2] == "O":
  if seen[5] == seen[8] == "O":
    print("YES")
    over = True
  elif seen[4] == seen[6] == "O":
    print("YES")
    over = True
elif seen[8] == "O" == seen[7] == seen[6] or seen[3] == seen[4] == seen[5] == "O" or seen[1] == seen[4] == seen[7] == "O":
  print("YES")
  over = True
if not over:
  print("YES")

### FIXED CODE ###

seen = [0,0,0,0,0,0,0,0,0]
seen[0],seen[1],seen[2] = (map(int,input().split()))
seen[3],seen[4],seen[5] = (map(int,input().split()))
seen[6],seen[7],seen[8] = (map(int,input().split()))
over = "No"
N = int(input())
for x in range(N):
  num = int(input())
  if num in seen:
    seen[seen.index(num)] = "O"
if seen[0] == "O":
  if seen[1] == "O" and seen[2] == "O":
    over = "Yes"
  if seen[3] == "O" and seen[6] == "O":
    over = "Yes"
  if seen[4] == "O" and seen[8] == "O":
    over = "Yes"
if seen[8] == "O":
  if seen[6] == "O" and seen[7] == "O":
    over = "Yes"
  if seen[2] == "O" and seen[5] == "O":
    over = "Yes"
if seen[4] == "O":
  if seen[6] == "O" and seen[2] == "O":
    over = "Yes"
  if seen[1] == "O" and seen[7] == "O":
    over = "Yes"
  if seen[3] == "O" and seen[5] == "O":
    over = "Yes"
print(over)
n, k = map(int, input().split())
modulo = 10 ** 9 + 7
*arr, = map(int, input().split())
inverses = [pow(v, modulo - 2, modulo) for v in arr]
neg_cnt = 0
for v in arr:
    if v < 0:
        neg_cnt += 1


def min_pos(arr):
    pass


if neg_cnt == n:
    res = 1
    arr.sort(reverse=True)
    for i in range(k):
        res *= arr[i]
        res %= modulo
    print(res)
elif k == n:
    res = 1
    for v in arr:
        res *= v
        res %= modulo
    print(res)
else:
    pos = []
    neg = []
    for i, v in enumerate(arr):
        if v < 0:
            neg.append(i)
        else:
            pos.append(i)

    neg.sort(key=lambda v: abs(arr[i]))
    pos.sort(key=lambda v: abs(arr[i]))

    if k % 2:
        res = arr[pos[0]] % modulo
        i = 1
    else:
        res = 1
        i = 0
    j = 0
    while i + j < k:
        if j == len(pos) or i < len(pos) and arr[pos[i]] * arr[pos[i + 1]] > arr[neg[j]] * arr[neg[j + 1]]:
            res *= arr[pos[i]]
            res *= arr[pos[i + 1]]
            i += 2
        else:
            res *= arr[neg[j]]
            res *= arr[neg[j + 1]]
            j += 2
        res %= modulo

    print(res)




### FIXED CODE ###

n, k = map(int, input().split())
modulo = 10 ** 9 + 7
*arr, = map(int, input().split())
inverses = [pow(v, modulo - 2, modulo) for v in arr]
neg_cnt = 0
for v in arr:
    if v < 0:
        neg_cnt += 1

def min_pos(arr):
    pass


if k == n:
    res = 1
    for v in arr:
        res *= v
        res %= modulo
    print(res)
elif neg_cnt == n and k % 2 == 1:
    res = 1
    arr.sort(reverse=True)
    for i in range(k):
        res *= arr[i]
        res %= modulo
    print(res)
else:
    pos = []
    neg = []
    for i, v in enumerate(arr):
        if v < 0:
            neg.append(i)
        else:
            pos.append(i)

    neg.sort(key=lambda v: abs(arr[v]), reverse=True)
    pos.sort(key=lambda v: abs(arr[v]), reverse=True)


    if k % 2:
        res = arr[pos[0]]
        i = 1
    else:
        res = 1
        i = 0
    j = 0
    while i + j < k and (i < len(pos) - 1 or j < len(neg) - 1):
        if j >= len(neg) - 1 or i < len(pos) - 1 and arr[pos[i]] * arr[pos[i + 1]] > arr[neg[j]] * arr[neg[j + 1]]:
            res *= arr[pos[i]]
            res *= arr[pos[i + 1]]
            i += 2
        else:
            res *= arr[neg[j]]
            res *= arr[neg[j + 1]]
            j += 2
        res %= modulo

    while i + j < k:
        res *= arr[pos[i]]
        i += 1
        res %= modulo

    print(res)
from fractions import gcd
N = int(input())
TA = [list(map(int, input().split())) for i in range(N)]

ans = 0
pre_t = 0
pre_a = 0

for t, a in TA:
    gcd = gcd(t, a)

    t = t * gcd
    a = a * gcd

    first_t = t
    first_a = a

    while (pre_t > t) or(pre_a > a):
        t += first_t
        a += first_a

    pre_t = t
    pre_a = a
    
print(t + a)


### FIXED CODE ###

N = int(input())
TA = [list(map(int, input().split())) for i in range(N)]
T, A = 1, 1

for t, a in TA:
    z = max(T//t, A//a)
    if (T > t*z) or (A > a*z):
        z += 1

    T = t * z
    A = a * z

print(T+A)
n = int(input())
i = 1
while i * i <= n:
  if n % i != 0:
    continue
  j = n // i
  if i < 10 and j < 10:
    print("Yes")
	quit()
print("No")

### FIXED CODE ###

n = int(input())
i = 1
while i * i <= n:
    if n % i == 0:
        j = n // i
        if i < 10 and j < 10:
            print("Yes")
            quit()
    i += 1
print("No")
a = list(map(int,input().split()))
a.replace(1,99)
if a[0] > a[1]:
  print("Bob")
elif a[0] == a[1]:
  print("Draw")
else:
  print("Alice")

### FIXED CODE ###

a = list(map(int,input().split()))
if a[0] == a[1]:
  print("Draw")
elif (a[0] == 1 or a[0] >= a[1]) and a[1] !=1:
  print("Alice")
else:
  print("Bob")
x = input()

y = x * 3

print int(y)

### FIXED CODE ###

x = int(input())
print(x ** 3)