Harryxun/stf_run huggingface dataset:
import functools


class SearchProblem(object):
    def __init__(self, N, H):
        self.N = N
        self.H = H

    def isEnd(self, i):
        return i == self.N

    def succ(self, i):
        res = []
        if i + 1 <= self.N:
            res.append((i + 1, abs(self.H[i + 1] - self.H[i])))
        if i + 2 <= self.N:
            res.append((i + 2, abs(self.H[i + 2] - self.H[i])))
        return res


def solve(problem: SearchProblem):
    @functools.lru_cache(maxsize=None)
    def future_cost(s):
        if problem.isEnd(s):
            return 0
        else:
            return min(
                cost + future_cost(next_state) for next_state, cost in problem.succ(s)
            )

    return future_cost(1)


if __name__ == "__main__":
    N = int(input())
    H = [None] + [int(x) for x in input().split(" ")]
    problem = SearchProblem(N, H)
    print(solve(problem))

### FIXED CODE ###

def solve(n):
    table = [0 for i in range(N + 1)]
    for i in range(1, n + 1):
        if i == 1:
            table[1] = 0
        elif i == 2:
            table[2] = abs(H[2] - H[1])
        else:
            table[i] = min(
                table[i - 1] + abs(H[i] - H[i - 1]), table[i - 2] + abs(H[i] - H[i - 2])
            )
    return table[n]


if __name__ == "__main__":
    N = int(input())
    H = [0] + [int(x) for x in input().split(" ")]

    print(solve(N))
def resolve():
    from collections import deque

    h, w = map(int, input().split())
    c_h, c_w = map(int, input().split())
    c_h -= 1
    c_w -= 1
    d_h, d_w = map(int, input().split())
    d_h -= 1
    d_w -= 1
    dist = [[10**18 for i in range(w)] for i in range(h)]
    dist[c_h][c_w] = 0

    C = []
    for _ in range(h):
        C.append(list(input()))
    D = [(-1, 0), (1, 0), (0, -1), (0, 1)]
    queue = deque([(c_h, c_w)])

    while queue:
        (x, y) = queue.popleft()
        d = dist[x][y]

        for (dx, dy) in D:
            new_x, new_y = x + dx, y + dy
            if -1 < new_x < h and -1 < new_y < w:
                if C[new_x][new_y] == '.' and dist[new_x][new_y] > d:
                    dist[new_x][new_y] = d
                    queue.appendleft((new_x, new_y))

        for dx in range(-2, 3):
            for dy in range(-2, 3):
                if -1 < x + dx < h and -1 < y + dy < w and (x + dx == 0 and y + dy == 0):
                    if C[x + dx][y + dy] == '.' and dist[x + dx][y + dy] > d:
                        dist[x + dx][y + dy] = d + 1
                        queue.append((x + dx, y + dy))

    ans = dist[d_h][d_w]
    if ans == 10**18:
        print(-1)
    else:
        print(ans)

resolve()

### FIXED CODE ###

def resolve():
    import math
    n, x, t = map(int, input().split())
    print(math.ceil(n / x) * t)

resolve()
import pandas
import math
import numpy
import collections

x = input()
TF =  x.isupper() and x.isalpha()
if(TF):
    li = [i for i in x]
    count_dict = collections.Counter(li)
    list = [v for k, v in count_dict.items()]
    
    if(list == [2,2]):
        print("Yes")
        
print("No")

### FIXED CODE ###

import collections

x = input()
TF =  x.isupper() and x.isalpha()
flg  = 0
if(TF):
    li = [i for i in x]
    count_dict = collections.Counter(li)
    list = [v for k, v in count_dict.items()]
    if(list == [2,2]):
        print("Yes")
        flg = 1
if(flg == 0):
    print("No")
for testcase in range(int(input())):
	D,T,S=map(int,input().split())
	d=S*T
	if d>=D:
		print('Yes')
	else:
		print('No')	
		                                         

### FIXED CODE ###

D,T,S=map(int,input().split())
t=D/S
if t<=T:
  print('Yes')
else:
  print('No')
a,b = map(int, input().split())

d = (a * b) % 2

if d = 0:
    print("Even")
else:
    print("Odd")

### FIXED CODE ###

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

c = (a * b) % 2

if c == 0:
    print("Even")
elif c == 1:
    print("Odd")
S , T =  [str(x) for x in input().split()]

A , B =  [int(x) for x in input().split()]

U = input()
    
if S ==  U:
    A = A - 1
else:
    B = B - 1
    
print(A,B)
S = input()
print('x'*len(S))

### FIXED CODE ###

S , T =  [str(x) for x in input().split()]

A , B =  [int(x) for x in input().split()]

U = input()
# S = input()   
if S ==  U:
    A = A - 1
elif T==U:
    B = B - 1   
print(A,B)
import math

def solve():
    a, b = map(int, input().split())
    ans = a * b / math.gcd(a, b)
    print(int(ans))

if __name__ == '__main__':
    solve()




### FIXED CODE ###

import fractions

def solve():
    a, b = map(int, input().split())
    ans = a * b / fractions.gcd(a, b)
    print(int(ans))

if __name__ == '__main__':
    solve()
S = list(input())
print('2017/01/'+S[8:])


### FIXED CODE ###

S = list(input())
print('2018/01/'+''.join(S[8:]))
#coding:utf-8

li = input().split("")
t = 0
s = int(li.pop(5))
for i in li:
    for k in li:
        if int(k) - int(i) >= s:
            t = 1

if t == 0:
    print("Yay!")
else:
    print(":(")

while True:
    s += 1

### FIXED CODE ###

li = []
for l in range(6):
    li.append(input())

t = 0
s = li.pop()
for i in li:
    for k in li:
        if int(k) - int(i) > int(s):
            t = 1
        elif int(i) - int(k) > int(s):
            t = 1

if t == 0:
    print("Yay!")
else:
    print(":(")
n=int(input())
if n%2=0:
  print 0.5
elif:
  print ((n//2)/n)

### FIXED CODE ###

n=int(input())
if n%2==0:
  print (0.5)
else:
  print (1-((n//2)/n))
A, B = map(int, input().split())
return max(A+B, max(A-B, A*B))

### FIXED CODE ###

A, B = map(int, input().split())
print(max(A+B, max(A-B, A*B)))
N,M= map(int,input().split())

tempP = ""
ac = []
wa = []

for count in range(N):
    ac.append(0)
    wa.append(0)

for count in range(M):
    P,S = input().split()
    P = int(P)
    P -= 1
    
    if ac[P] == 0:
        if S == "AC":
            ac[P] = 1
        else:
            wa[P] +=1



a = 0
b = 0
 
for i in range(n):
    if ac[i] == 1:
        a += 1
        b += wa[i]
 
print(*[a, b])

    

### FIXED CODE ###

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

tempP = ""
ac = []
wa = []

for count in range(N):
    ac.append(0)
    wa.append(0)

for count in range(M):
    P,S = input().split()
    P = int(P)
    P -= 1
    
    if ac[P] == 0:
        if S == "AC":
            ac[P] = 1
        else:
            wa[P] +=1



a = 0
b = 0
 
for i in range(N):
    if ac[i] == 1:
        a += 1
        b += wa[i]
 
print(*[a, b])
while 1:
	n = input()
	if n == 0: break
	N = [int(raw_input()) for i in range(n)]
	s = input()
	i = n/2
	c = 1
	while i > 0:
		c += 1
		if N[i] == s:
			break
		elif N[i] < s:
			i /= 2
		else:
			i += i/2
	print c

### FIXED CODE ###

while 1:
	n = input()
	if n == 0: break
	N = [input() for i in range(n)]
	s = input()
	l,r= 0,n-1
	c = 0
	while l <= r:
		i = (l + r)/2
		c += 1
		if N[i] == s:
			break
		elif N[i] < s:
			l = i + 1
		else:
			r = i - 1
	print c
def add_node_2_tree_dic(tree_dic, x, y):
    if x not in tree_dic:
        tree_dic[x] = [y]
    else:
        tree_dic[x].append(y)

#   深さ優先探索で行けそう

N = int(input())
tree_dic = {}
for _ in range(N-1):
    a, b = map(int, input().split())
    add_node_2_tree_dic(tree_dic, a, b)
    add_node_2_tree_dic(tree_dic, b, a)

c_lst = list(map(int, input().split()))
c_lst.sort()
ans_lst = [0]*N

def search_next_node_and_add_side_wate(tree_dic, ans, current_node, c_lst, ans_lst):
    tmp_lst = tree_dic[current_node][:]
    for next_node in tmp_lst:
        c = c_lst.pop()
        ans += c
        ans_lst[next_node - 1] = c

        tree_dic[current_node].remove(next_node)    #   今回通った枝を取り払う
        tree_dic[next_node].remove(current_node)
        if len(tree_dic[current_node]) == 0:
            del tree_dic[current_node]#   探索し終えたノードの削除
        if len(tree_dic[next_node]) == 0:
            del tree_dic[next_node]#   探索し終えたノードの削除
            
        else:   #   次のノードにつながっている辺があるとき
            ans = search_next_node_and_add_side_wate(tree_dic, ans, next_node, c_lst, ans_lst)



    return ans


ans = 0
current_node = 1
ans_lst[0] = c_lst.pop()
ans = search_next_node_and_add_side_wate(tree_dic, ans, current_node, c_lst, ans_lst)


ans_str = ""
for i in range(N):
    ans_str += str(ans_lst[i])
    if i != N - 1:
        ans_str += " "


print(ans)
print(ans_str)



### FIXED CODE ###

import sys
sys.setrecursionlimit(20000)

def add_node_2_tree_dic(tree_dic, x, y):
    if x not in tree_dic:
        tree_dic[x] = [y]
    else:
        tree_dic[x].append(y)

#   深さ優先探索で行けそう

N = int(input())
tree_dic = {}
for _ in range(N-1):
    a, b = map(int, input().split())
    add_node_2_tree_dic(tree_dic, a, b)
    add_node_2_tree_dic(tree_dic, b, a)

c_lst = list(map(int, input().split()))
c_lst.sort()
ans_lst = [0]*N

def search_next_node_and_add_side_wate(tree_dic, ans, current_node, c_lst, ans_lst):
    next_node_lst = tree_dic[current_node][:]

    for next_node in next_node_lst:
        c = c_lst.pop()
        ans += c
        ans_lst[next_node - 1] = c

        tree_dic[current_node].remove(next_node)    #   今回通った枝を取り払う
        tree_dic[next_node].remove(current_node)

        if len(tree_dic[current_node]) == 0:
            del tree_dic[current_node]#   探索し終えたノードの削除
        if len(tree_dic[next_node]) == 0:
            del tree_dic[next_node]#   探索し終えたノードの削除
        else:   #   次のノードにつながっている辺があるとき
            ans = search_next_node_and_add_side_wate(tree_dic, ans, next_node, c_lst, ans_lst)

    return ans


ans = 0
current_node = 1
ans_lst[0] = c_lst.pop()
ans = search_next_node_and_add_side_wate(tree_dic, ans, current_node, c_lst, ans_lst)


ans_str = ""
for i in range(N):
    ans_str += str(ans_lst[i])
    if i != N - 1:
        ans_str += " "


print(ans)
print(ans_str)
import math

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

a.sort()

print(a[-1]-a[0])


### FIXED CODE ###

import math

n=input()
a=sorted(map(int,input().split()))


print(a[-1]-a[0])
n, m = map(int, input().split())
num = ['x'] * n
flag = 0

if n == 1:
    for i in range(m):
        if m == 0:
            print(0)
            flag = 1
            break
        else:
            s, c = map(int, input().split())
            if num[s-1] == 'x':
                num[s-1] = c
            else:
                if num[s-1] != c:
                    print(-1)
                    flag = 1
                    break
    if flag == 0:
        print(num[s-1])

else:
    for i in range(m):
        s, c = map(int, input().split())
        if num[s-1] == 'x':
            num[s-1] = c
            if s == 1 and c == 0:
                print(-1)
                flag = 1
                break
                
        else:
            if num[s-1] != c:
                print(-1)
                flag = 1
                break
    if flag == 0:
        if num[0] == 'x':
            num[0] = 1
        for j in range(1, n):
            if num[j] == 'x':
                num[j] = 0 
        str_num = map(str, num)
        print(''.join(str_num))

### FIXED CODE ###

n, m = map(int, input().split())
num = ['x'] * n
flag = 0

if n == 1:
    if m == 0:
        print(0)
    else:
        for i in range(m):
            s, c = map(int, input().split())
            if num[s-1] == 'x':
                num[s-1] = c
            else:
                if num[s-1] != c:
                    print(-1)
                    flag = 1
                    break
        if flag == 0:
            print(num[s-1])

else:
    for i in range(m):
        s, c = map(int, input().split())
        if num[s-1] == 'x':
            num[s-1] = c
            if s == 1 and c == 0:
                print(-1)
                flag = 1
                break
                
        else:
            if num[s-1] != c:
                print(-1)
                flag = 1
                break
    if flag == 0:
        if num[0] == 'x':
            num[0] = 1
        for j in range(1, n):
            if num[j] == 'x':
                num[j] = 0 
        str_num = map(str, num)
        print(''.join(str_num))
x = int(input())
 
a = x // 500
b = (x % 500) // 5
 
ans = a * 1000 + b * 5
 
 print(ans)

### FIXED CODE ###

x = int(input())

a = x // 500

b = (x % 500) // 5
 
ans = a * 1000 + b * 5
 
print(ans)
n,m,*a=map(int,open(0).read().split())
b=[-1]*(n+1)
a+=[0,0]
for i in a:
    b[i]=0

if a[0]==1 and a[1]==2:
    b[1],b[2]=0,0
elif a[0]==1:
    b[2]=1
elif a[0]==2:
    b[1]=1
else:    
    b[1],b[2]=1,2
for i in range(3,n+1):
    if b[i]==-1:
        b[i]=(b[i-1]+b[i-2])%1000000007
print(b[-1])

### FIXED CODE ###

n,m,*a=map(int,open(0).read().split())
if n==1:
    print(1)
    exit()
b=[-1]*(n+1)
a+=[0,0]
for i in a:
    b[i]=0
if a[0]==1 and a[1]==2:
    b[1],b[2]=0,0
elif a[0]==1:
    b[2]=1
elif a[0]==2:
    b[1]=1
else:    
    b[1],b[2]=1,2
for i in range(3,n+1):
    if b[i]==-1:
        b[i]=(b[i-1]+b[i-2])%1000000007
print(b[-1])
n,a,b = map(int,input()split())
print(min(n*a,b))

### FIXED CODE ###

n,a,b = map(int,input().split())
print(min(n*a,b))
import sys
readline = sys.stdin.readline
write = sys.stdout.write

def num(key):
    if key == 1:
        return 2
    elif key == 7:
        return 3
    elif key == 4:
        return 4
    elif key == 9 or key == 6:
        return 6
    elif key == 8:
        return 7
    else:
        return 5

N, M, = readline().split()
N = int(N)
M = int(M)
A = list(map(int, readline().split()))
A.sort(reverse = True)
dp = [-float('inf'),] *(N+1)
dp[0] = 0
for i in range(1, N+1):
    temp = []
    for j in range(M):
        if i - num(A[j]) >= 0:
            temp.append(dp[i-num(A[j])] + 1)
    if len(temp) > 0:
        dp[i] = max(temp)

digit = dp[N]
ans = []
for i in range(digit):
    for j in range(M):
        if dp[N-num(A[j])] == dp[N] - 1 and N - num(A[j]) >= 0:
            ans.append(A[j])
            N = N - num(A[j])
            break
for i in range(digit):
    write(str(ans[i]))
write("\n")

### FIXED CODE ###

import sys
readline = sys.stdin.readline
write = sys.stdout.write

def num(key):
    if key == 1:
        return 2
    elif key == 7:
        return 3
    elif key == 4:
        return 4
    elif key == 9 or key == 6:
        return 6
    elif key == 8:
        return 7
    else:
        return 5

N, M, = readline().split()
N = int(N)
M = int(M)
A = list(map(int, readline().split()))
A.sort(reverse = True)
dp = [-float('inf'),] *(N+1)
dp[0] = 0
for i in range(1, N+1):
    temp = []
    for j in range(M):
        if i - num(A[j]) >= 0:
            temp.append(dp[i-num(A[j])] + 1)
    if len(temp) > 0:
        dp[i] = max(temp)

digit = dp[N]
ans = []
for i in range(digit):
    for j in range(M):
        if N - num(A[j]) >= 0 and dp[N-num(A[j])] == dp[N] - 1:
            ans.append(A[j])
            N = N - num(A[j])
            break
for i in range(digit):
    write(str(ans[i]))
write("\n")
x,n=map(int,input().split())
r=[i-x for i in map(int,input())]
for i in range(100):
  if not -i in r:
    print(x-i)
  elif not i in r:
    print(x+i)

### FIXED CODE ###

x,n=map(int,input().split())
r=[i-x for i in map(int,input().split())]
for i in range(n+1):
  if not -(i) in r:
    print(x-i)
    break
  elif not i in r:
    print(x+i)
    break
import itertools
import numpy as np

X = int(input())
#maxs = int(X**(1/5))

l = np.arange(-63, 64)

comb = np.array(list(itertools.combinations_with_replacement(l, 2)))

sum1 = comb[:, 0]**5 - comb[:, 1]**5
sum2 = comb[:, 1]**5 - comb[:, 0]**5

try:
    result1 = np.where(sum1==X)[0][0]
    print(comb[result1][0], comb[result1][1])
except:
    result2 = np.where(sum2==X)[0][0]
    print(comb[result2][1], comb[result2][0])

### FIXED CODE ###

import itertools
import numpy as np

X = int(input())
maxs = int(X**(1/5))

l = np.arange(-126, 127)

comb = np.array(list(itertools.combinations_with_replacement(l, 2)))

sum1 = comb[:, 0]**5 - comb[:, 1]**5
sum2 = comb[:, 1]**5 - comb[:, 0]**5

if len(np.where(sum1==X)[0]) != 0:
    result1 = np.where(sum1==X)[0][0]
    print(comb[result1][0], comb[result1][1])
else:
    result2 = np.where(sum2==X)[0][0]
    print(comb[result2][1], comb[result2][0])
import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)
a,b=map(int,input().split())
print(lcm(a, b))


### FIXED CODE ###

from fractions import gcd
a,b=map(int,input().split())
ans=(a*b)//gcd(a,b)
print(ans)
N = int(input())
ans = [2,1]
for i in range(2,N):
  a = ans[i-2] + ans[i-1]
  ans.append(a)
print(ans[len(ans)])
  

### FIXED CODE ###

N = int(input())
ans = [2,1]
for i in range(2,N+1):
  a = ans[i-2] + ans[i-1]
  ans.append(a)
print(ans[len(ans)-1])
input()
 nums = [ int(i) for i in input().split()]
??????
 print( min(nums), max(nums), sum(nums))

### FIXED CODE ###

input()
nums = [ int(i) for i in input().split()]
print( min(nums), max(nums), sum(nums))
N = input()
list = [a for a in input().split()]
count = 0
for i in range(len(list)):
#    print(list[i])
 #   print(list.count(list[i]))
    if list[i] != list.count(list[i]):
        list.remove(list[i])
        count += 1
    if i == len(list)-1:
        break
 #   print(list)
 #   print(count)
print(count)
        

### FIXED CODE ###

N = int(input())
list = [int(a) for a in input().split()]
dict = dict()
for i in range(N):
    if list[i] in dict:
        dict[list[i]] += 1
    else:
        dict[list[i]] = 1
count = 0
for i, j in dict.items():
#    print(i, j) 
    if i <= j:
        count += j - i
    else:
        count += j
              
print(count)
date = inp.readline().rstrip().split(' ')
x = int(date[0])
y = int(date[1])
num1 = x + y
num2 = x - y
num3 = x * y

if num1 > num2:
    if num1 > num3:
        ans = num1
    else:
        ans = num3
elif num2 > num3:
    ans = num2
else:
    ans = num3

print(ans)

### FIXED CODE ###

x, y = list(map(int, input().split()))

num1 = x + y
num2 = x - y
num3 = x * y

if num1 > num2:
    if num1 > num3:
        ans = num1
    else:
        ans = num3
elif num2 > num3:
    ans = num2
else:
    ans = num3

print(ans)
n,d=map(int,input().split())
ans=0
for _ in range(n):
  a,b=map(int,input().split())
  if (a*a+b*b) <= d*d:
    ans+=1
    
print(ans)

### FIXED CODE ###

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

if y%2 ==1:
  print("No")
elif 2*x > y:
  print("No")
elif 4*x < y:
  print("No")
else:
  print("Yes")
X,N = map(int,input())
if N > 0:
    A = list(map(int,input()))
    for i in range(100):
        x = X - i
        y = X - i
    if x not in A:
        print(x)
        quit()
    if y not in A:
        print(y)
        quit()
else:
    print(N)

### FIXED CODE ###

X,N = map(int,input().split())
if N > 0:
    A = list(map(int,input().split()))
    d = {}
    for i in range(102):
        d[i] = 0
    for a in A:
        d[a] = 1
    for i in range(0,100):
        x = X - i
        y = X + i
        if d[x] == 0:
            print(x)
            quit()
        if d[y] == 0:
            print(y)
            quit()
else:
    print(X)
import sys

H, N = map(int, input().split())
AB = [list(map(int, sys.stdin.readline().split())) for _ in range(N)]

dp = [0 for _ in range(H+1)]
for h in range(1, len(dp)):
    dp[h] = min(dp[h-a] + b for a, b in AB)

print(dp[H])


### FIXED CODE ###

import sys

H, N = map(int, input().split())
AB = [list(map(int, sys.stdin.readline().split())) for _ in range(N)]

dp = [0 for _ in range(H + max(AB, key=lambda x: x[0])[0])]
for h in range(1, len(dp)):
    dp[h] = min(dp[h-a] + b for a, b in AB)

print(dp[H])
from math import gcd
N = int(input())
A = [int(i) for i in input().split()]
st=set()
s=0
pn = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997]

for a in A:
  if a == 1:
    continue
  ary=[]
  d={}
  while a % 2 == 0:
    if 2 in d:
      d[2] += 1
    else:
      d[2] = 1
    a//=2
  i=1
  n = 3
  while n * n <= a:
    if a % n == 0:
      a //= n
      if n in d:
        d[n] += 1
      else:
        d[n] = 1
    else:
      i += 1
      n=pn[i]
  if a > 1:
    ary.append(a)
    if a in d:
      d[a]=1

  for k in d.keys():
    if k in st:
      break
    else:
      st.add(k)
  else:
    continue

  n=gcd(A[0],A[1])
  for a in A[2:]:
    n=gcd(n,a)
  if n == 1:
    print("setwise coprime")
  else:
    print("not coprime")
  exit()
 
print("pairwise coprime")


### FIXED CODE ###

N = int(input())
A = [int(i) for i in input().split()]
maxA=max(A)
pn=list(range(maxA+1))
n=2
while n*n <= maxA:
  if n == pn[n]:
    for m in range(n, len(pn), n):
      if pn[m] == m:
        pn[m] = n
  n+=1

s=set()
for a in A:
  st = set()
  while a > 1:
    st.add(pn[a])
    a//=pn[a]
  if not s.isdisjoint(st):
    break
  s |= st
else:
  print("pairwise coprime")
  exit()

from math import gcd

n = gcd(A[0], A[1])
for a in A[2:]:
  n=gcd(n,a)
if n == 1:
  print("setwise coprime")
else:
  print("not coprime")
import math
x1,y1,x2,y2 = map(int,input().split())
D = math.sqrt((x2-x1)**2+(y2-y1)**2)
print(D)

### FIXED CODE ###

import math
 
x1,y1,x2,y2=list(map(float,input().split()))
 
print(math.sqrt((x2-x1)**2+(y2-y1)**2))
a = input()
s = 0
if a == "RRR":
  s = 3
elif a == "RRS" or a == "SRR":
  s = 2
elif a = "SSS":
  s = 0
else:
  s = 1
print(s)

### FIXED CODE ###

a = input()
s = 0
if a == "RRR":
  s = 3
elif a == "RRS" or a == "SRR":
  s = 2
elif a == "SSS":
  s = 0
else:
  s = 1
print(s)
n, x = map(int, input().split())
if abs(n-x)<=1 :
  print('Yes')
else:
  print('No')
  exit()
if n == x:
  for i in range(2*(n-1)):
    print(i+1)
elif x == n-1:
  print(n)
  for i in range(2*(n-1)):
    if i != n:
      print(i)
else x == n-1:
  for i in range(2*(n-1)):
    if i != n:
      print(i)
  print(n)

### FIXED CODE ###

n, x = map(int, input().split())
if 2<=x<=2*(n-1):
  print('Yes')
else:
  print('No')
  exit()
  
if x == n:
  for i in range(1, 2*n):
    print(i)
elif x < n:
  for i in range(n, x, -1):
    print(i)
  for i in range(1, x+1):
    print(i)
  for i in range(n+1, 2*n):
    print(i)
else:
  for i in range(1, n):
    print(i)
  for i in range(x, 2*n):
    print(i)
  for i in range(x-1, n-1, -1):
    print(i)
A,B=map(int,input().split())

if 9>=A,B>=1:
  print(A*B)
else:
  print(-1)

### FIXED CODE ###

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

if 9 >= a >= 1 and 9 >= b >= 1:
  print(a*b)
else:
  print(-1)
a = list(map(int,input().split()))
z = 0
b = [1]
c = [0]*n
for i in range(n*3):
  j = [a[b[i]-1]]
  b.extend(j)
  c[a[b[i]-1]-1] = c[a[b[i]-1]-1]+1
  if c[a[b[i]-1]-1] == 2:
    z = z + 1

if k <= n:
  y = b[k]
else:
  l = (k-n)%z
  y = b[n+l]
print(y)

### FIXED CODE ###

n,k = map(int,input().split())
a = list(map(int,input().split()))
z = 0
b = [1]
c = [0]*n
for i in range(n*3):
  j = [a[b[i]-1]]
  b.extend(j)
  c[a[b[i]-1]-1] = c[a[b[i]-1]-1]+1
  if c[a[b[i]-1]-1] == 2:
    z = z + 1
if k <= n:
  y = b[k]
else:
  l = (k-n)%z
  y = b[n+l]
print(y)
import math

a = input()
oturi = math.ceil(a/1000)*1000-a

print(oturi)

### FIXED CODE ###

import math
 
a = int(input())
oturi = math.ceil(a/1000)*1000-a
 
print(oturi)
N = int(input())
mod = 10** + 7
if N == 1:
  print(0)
else:
  ans = N*10**(n-2)
  print(ans%mod)

### FIXED CODE ###

n = int(input())
mod = 10**9+7
a = 10**n-9**n-9**n+8**n
print(a%mod)