Harryxun/stf_run huggingface dataset:
import math
##(A,B,C,D)=map(int,input().split())

N=int(input())
##c=list(map(int, input().split()))


a=[]
b=[]


for i in range(N):
    a.append(int(input()))
    b.append(int(input()))
k=float(0)
for i in range(N-1):
    for j in range(i,N):
        k=k+float(((a[i]-a[j])**2+(b[i]+b[j])**2)**0.5)

k=float(k*2/N)
print(k)




### FIXED CODE ###

N=int(input())
##c=list(map(int, input().split()))

a = [list(map(int, input().split())) for _ in range(N)]

k=0
for i in range(N):
    for j in range(N):
        if(i!=j):
            k=k+((a[i][0]-a[j][0])*(a[i][0]-a[j][0])+(a[i][1]-a[j][1])*(a[i][1]-a[j][1]))**0.5

print(k/N)
li = list(map(int,input.split()))
li2 = set(li2)#liの中の被っている要素を排除する（例：3 2 2 > 3 2）
if len(li2) == 2:#かぶり要素を排除したときのリスト内部の個数が２になっている
    print("Yes")
else:
    print("No")

### FIXED CODE ###

from sys import stdin
li = list(map(int,stdin.readline().rstrip().split()))
li = list(set(li))
if len(li) == 2:
    print("Yes")
else:
    print("No")
import sys
input = sys.stdin.readline

def main():
    sa = input().strip()
    sb = input().strip()
    sc = input().strip()
    
    rest_a = 0
    rest_b = 0
    rest_c = 0
    rest_a += 1
    next_ = sa[0]
    while True:
        if next_ == "a":
            if rest_a == len(sa) - 1:
                print("A")
                break
            else:
                next_ = sa[rest_a]
                rest_a += 1
        elif next_ == "b":
            if rest_b == len(sb) - 1:
                print("B")
                break
            else:
                next_ = sb[rest_b]
                rest_b += 1
        elif next_ == "c":
            if rest_c == len(sc) - 1:
                print("C")
                break
            else:
                next_ = sc[rest_c]
                rest_c += 1

if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys
input = sys.stdin.readline

def main():
    a = input().strip() + "w"
    b = input().strip() + "w"
    c = input().strip() + "w"

    i, j, k = 0, 0, 0
    now = "a"
    while True:
        # print(now, i, j, k)
        if now == "a":
            now = a[i]
            i += 1
            if now == "w":
                win = "a"
                break
        elif now == "b":
            now = b[j]
            j += 1
            if now == "w":
                win = "b"
                break
        else:
            now = c[k]
            k += 1
            if now == "w":
                win = "c"
                break

    if win == "a":
        print("A")
    elif win == "b":
        print("B")
    else:
        print("C")

if __name__ == "__main__":
    main()
N, M = [int(x) for x in input().split()]
P = [[False] * M for m in range(M)]
dict={}
for m in range(M):
  a, b = [int(x) for x in input().split()]
  P[a-1][b-1] = True
  P[b-1][a-1] = True

def dp(x, past):
  past[x] = True
  if (x, tuple(past)) in dict:
    return dict[(x, tuple(past))]
  if False not in past:
    return 1
  ret = 0
  for i,p in enumerate(P[x]):
    if not p or x == i or past[i]:
      continue
    else:
      ret += dp(i, past[:])
  dict[(x, tuple(past))] = ret
  return ret

if M < N - 1:
  print(0)
else:
  print(dp(0, [False] * N))

### FIXED CODE ###

N, M = [int(x) for x in input().split()]
P = [[False] * N for m in range(N)]
dict={}
for m in range(M):
  a, b = [int(x) for x in input().split()]
  P[a-1][b-1] = True
  P[b-1][a-1] = True

def dp(x, past):
  past[x] = True
  if (x, tuple(past)) in dict:
    return dict[(x, tuple(past))]
  if False not in past:
    return 1
  ret = 0
  for i,p in enumerate(P[x]):
    if not p or x == i or past[i]:
      continue
    else:
      ret += dp(i, past[:])
  dict[(x, tuple(past))] = ret
  return ret

if M < N - 1:
  print(0)
else:
  print(dp(0, [False] * N))
l, r, d = map(int, input().split())
count = 0
for i int range (l, r+1):
  if i % d == 0:
    count += 1
print(count)

### FIXED CODE ###

l, r, d = map(int, input().split())
count = 0
for i in range (l, r+1):
  if i % d == 0:
    count += 1
print(count)
import sys
input = lambda: sys.stdin.readline().rstrip()
input_nums = lambda: list(map(int, input().split()))
sys.setrecursionlimit(3000)

N, M = input_nums()

G = {}
for i in range(N):
    G[i] = []

for i in range(M):
    x, y = input_nums()
    x -= 1
    y -= 1
    G[x].append(y)

dp = [-1 for _ in range(N+1)]

def rec(v: int):
    if dp[v] != -1:
        return dp[v]
    res = 0
    for nv in G[v]:
        res = max(res, rec(nv) + 1)
    dp[v] = res
    return res

res = 0
for v in range(N):
    res = max(res, rec(v))
print(res)

### FIXED CODE ###

import sys
input = lambda: sys.stdin.readline().rstrip()
input_nums = lambda: list(map(int, input().split()))
sys.setrecursionlimit(10**6)

N, M = input_nums()

G = {}
for i in range(N):
    G[i] = []

for i in range(M):
    x, y = input_nums()
    x -= 1
    y -= 1
    G[x].append(y)

dp = [-1 for _ in range(N+1)]

def rec(v: int):
    if dp[v] != -1:
        return dp[v]
    res = 0
    for nv in G[v]:
        res = max(res, rec(nv) + 1)
    dp[v] = res
    return res

res = 0
for v in range(N):
    res = max(res, rec(v))
print(res)
n=int(input())
for _ in range(n):
    p=[float(i) for i in input().split()]
    if round((p[3]-p[1])/(p[2]-p[0]),5)==round((p[7]-p[5])/(p[6]-p[4]),5):
        print("YES")
    else:
        print("NO")


### FIXED CODE ###

n=int(input())
for j in range(n):
    p=[float(i) for i in input().split()]
    if round((p[2]-p[0])*(p[7]-p[5])-(p[3]-p[1])*(p[6]-p[4]),10)==0:
        print("YES")
    else:
        print("NO")
# -*- coding: utf-8 -*-

X, Y, A, B, C = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

rest = [[0] + sorted(p),
        [0] + sorted(q),
        [0] + sorted(r)]

ans = 0
count = [0, 0, 0]
while sum(count) < (X + Y):

    candidates = [rest[i][-1] if count[i] == X else 0 for i in range(3)]

    wanna_eat = max(candidates)
    eat_idx = candidates.index(wanna_eat)

    count[eat_idx] += 1
    ans += rest[eat_idx].pop()

print(ans)


### FIXED CODE ###

# -*- coding: utf-8 -*-

X, Y, A, B, C = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

# all_apples = sorted(p + q + r, key=lambda x: -x)

p_rest = sorted(p + [0])
q_rest = sorted(q + [0])
r_rest = sorted(r + [0])

ans = 0
p_count = 0
q_count = 0
r_count = 0
while (p_count + q_count + r_count) < (X + Y):
    if p_count < X and q_count < Y:
        candidates = [p_rest[-1], q_rest[-1], r_rest[-1]]
    elif p_count < X and q_count == Y:
        candidates = [p_rest[-1], 0, r_rest[-1]]
    elif p_count == X and q_count < Y:
        candidates = [0, q_rest[-1], r_rest[-1]]

    wanna_eat = max(candidates)
    eat_idx = candidates.index(wanna_eat)

    if eat_idx == 0:
        p_count += 1
        ans += p_rest.pop()
    elif eat_idx == 1:
        q_count += 1
        ans += q_rest.pop()
    else:
        r_count += 1
        ans += r_rest.pop()
    # print(candidates, eat_idx, wanna_eat, p_count, q_count, r_count)

print(ans)
N, L= input().split()
s = []
for i in range(int(N)):
    s.append(input())
''.join(s.sort())


### FIXED CODE ###

n ,l = map(int, input().split())
s=sorted([input() for i in range(n)])
print(*s, sep="")
n = int(input())
a = sorted(list(map(int, input().split())))

a_max = a[-1]
dp = [1]*a_max

for i in set(a):
    j = 2
    while i*j <= a_max:
        dp[i*j-1] = 0
        j += 1

ans = 0
for i in range(n):
    if dp[a[i]-1] and a[i-1] != a[i] and a[i] != a[i+1]:
        ans += 1
print(ans)


### FIXED CODE ###

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

a_max = a[-1]
dp = [1]*a_max

for i in set(a):
    j = 2
    while i*j <= a_max:
        dp[i*j-1] = 0
        j += 1

a.append(0)
ans = 0
for i in range(n):
    if dp[a[i]-1] and a[i-1] != a[i] and a[i] != a[i+1]:
        ans += 1
print(ans)
h,a=map(int,input.split())
if h>a:
  print(h//a)
if h<=a:
  print(1)

### FIXED CODE ###

h,a=map(int,input().split())
if h>a:
  if h%a==0:print(h//a)
  if h%a>0:print(h//a+1)
if h<=a:
  print(1)
def sep():
    return map(int,input().strip().split(" "))
def lis():
    return list(sep())
import sys
sys.setrecursionlimit(10**6)

n,k,c=sep()
s=input()
c1=[0]*(n+5)
c2=[0]*(n+5)
for i in range(n):
    if s[i]=="x":
        c1[i]=c1[i-1]
    else:
        c1[i]=c1[i-c-1]+1
for i in range(n-1,-1,-1):
    if s[i]=="x":
        c2[i]=c2[i+1]
    else:
        c2[i]=c2[i+c+1]+1
ans=[]
if c2[1]==k-1 and s[0]=="o":
    ans.append(1)

for i in range(1,n-1):
    if s[i]=="x":
        continue
    if c1[i-1] + c2[i+1]==k-1:
        ans.append(i+1)

if c1[n-2]==k-1 and s[0]=="o":
    ans.append(n)

for i in ans:
    print(i)




### FIXED CODE ###

def sep():
    return map(int,input().strip().split(" "))
def lis():
    return list(sep())
import sys
sys.setrecursionlimit(10**6)

n,k,c=sep()
s=input()
c1=[0]*(n+5)
c2=[0]*(n+5)
for i in range(n):
    if s[i]=="x":
        c1[i]=c1[i-1]
    else:
        c1[i]=max(c1[i-1],c1[i-c-1]+1)
for i in range(n-1,-1,-1):
    if s[i]=="x":
        c2[i]=c2[i+1]
    else:
        c2[i]=max(c2[i+1],c2[(i+c+1)%n]+1)
ans=[]
if c2[1]==k-1 and s[0]=="o":
    ans.append(1)

for i in range(1,n-1):
    if s[i]=="x":
        continue
    if c1[i-1] + c2[i+1]==k-1:
        ans.append(i+1)

if n!=1:
    if c1[n-2]==k-1 and s[0]=="o":
        ans.append(n)

for i in ans:
    print(i)
n = []
while True:
    try:
        n=int(input())
        while n-a<1000:
          print(n-a)
          a+=1000
    except EOFError:
        break

### FIXED CODE ###

n=int(input())
print((1000-n%1000)%1000)
from collections import deque
N = int(input())
visited = [False]*N
tree = [[] for _ in range(N)]
tmp = []
for _ in range(N-1):
    a, b = map(lambda x: int(x-1), input().split())
    tree[a].append(b)
    tree[b].append(a)
    tmp.append((a, b))  # 順番を保持するため

ans = {}  # 連想配列で保持する

q = deque([0])  # 開始のノード
colors = [-1]*N  # そのノードにささっている辺の色
while len(q):  # 幅優先探索を開始する
    v = q.pop()  # 部分木の親のノード
    color = 1
    for e in v:  # 子供に対して操作を行う
        if visited[e]:
            continue
        visited[e] = True
        if colors[v] == color:
            color += 1
        ans[(v, e)] = color
        colors[e] = color
        color += 1
        q.append(e)

print(max(colors))
for a, b in tmp:
    print(ans[(a, b)])
    

### FIXED CODE ###

from collections import deque
N = int(input())
graph = [[] for _ in range(N)]
ans = {}
tmp = []
flag = [False] * N  # そのノードに到達済みか判定する
for _ in range(N-1):
    a, b = map(lambda x: int(x)-1, input().split())
    graph[a].append(b)
    graph[b].append(a)
    tmp.append((a, b))  # 最後に出力する時に使う
    ans[(a, b)] = -1
q = deque([0])  # 開始のノード
colors = [-1]*N
now_color = 0
while len(q):
    v = q.pop()
    flag[v] = True
    color = 1
    # vからeへの辺の色を塗る
    for e in graph[v]:

        if flag[e]:
            continue
        q.append(e)
        if color == colors[v]:
            color += 1
        ans[(v, e)] = color
        colors[e] = color
        color += 1
print(max(colors))
for a, b in tmp:
    print(ans[(a, b)])
a, b = map(str, input().split())
n = len(a)
al = int(a[:n//2])
ar = int(a[n//2:])
b = float(b)
print(al, ar)
res = str(int(al*b)) + str(int(ar * b))
print(res)


### FIXED CODE ###

from decimal import Decimal, ROUND_DOWN, getcontext
a, b = map(str, input().split())
getcontext().prec = 19
getcontext().rounding = ROUND_DOWN
x = Decimal(a)
y = Decimal(b)
print("{:}".format(Decimal(int(x * y)), rounding=ROUND_DOWN))
n = int(input())
a = int(input())
Max = -999999
Min = a
for i in range(n):
    x = int(input())
    if (Max < x - Min):
        Max = x - Min
    if ( x < Min):
        Min = x
print(Max)

### FIXED CODE ###

n = int(input())
a = int(input())
Max = -10 ** 9
Min = a
for i in range(n-1):
    x = int(input())
    if (Max < x - Min):
        Max = x - Min
    if (x < Min):
        Min = x
print(Max)
n,m=map(int,input().split())
a=[int(input()) for i in range(m)]
dp=[0]*n
dp[0]=1
dp[1]=1
for i in range(2,n+1):
  dp[i]=dp[i-1]+dp[i-2]
print(dp[n]%(10**9+7))

### FIXED CODE ###

n,m=map(int,input().split())
a=[int(input()) for i in range(m)]
dp=[1]*(n+1)
dp[0]=1
dp[1]=1
for i in range(m):
  if a[i]==1:
    dp[1]=0
  else:
    dp[a[i]]=0
for i in range(2,n+1):
  if dp[i]:
    dp[i]=dp[i-1]+dp[i-2]
print(dp[n]%(10**9+7))
A=input() B=input() C=input() K=input()
if (K<=A):
  print(K)
elif (A<K<=A+B):
  print(A)
else:
  print(2A+B-K)

### FIXED CODE ###

A, B, C, K = map(int, input().split())
if K <= A:
  print(K)
elif K <= A+B:
  print(A)
else:
  print(2*A+B-K)
a = [for int(i) in input.split()]
 
count = 0
for i in range(0, len(a)-1):
  if a[i] > a[i+1]:
    count += 1
    if count > 2:
      print('NO')
      break
  
  if i == len(a)-1:
    print('YES')


### FIXED CODE ###

N = int(input())
num_list = [int(_) for _ in input().split()]
 
count = 0
 
for i in range(0, N):
  if num_list[i] != i+1:
    count += 1
    
if count <= 2:
  print('YES')
else:
  print('NO')
N=int(input())
ans=0
m=0
for i in range(N):
    A=int(input())
    if A%2==0:
        m=m+1
        if A%3==0 or A%5==0:
            ans=ans+1
if m==ans:
    print('APPROVED')
else:
    print('DENIED')


### FIXED CODE ###

N=int(input())
M=list(map(int,input().split()))
S=[]
T=[]
for i in range(0,len(M))  :
  if M[i]%2==0:
    T.append(M[i])
    S.append(M[i])
for j in range(0,len(S)):
  if S[j]%3!=0 and S[j]%5!=0:
      T.remove(S[j])
    
if len(S)==len(T):
  print('APPROVED')
else:
  print('DENIED')
n,x = map(int,input().split())

def get_result():
    if x == 1 or x == 2*n-1:
        return []
    
    if N == 2:
        return [1,2,3]
    
    if x == 2:
        center = [3,2,1,4]
        others = list(range(5,2*n))
    elif x == 2*n-2:
        center = [2*n-3,2*n-2,2*n-1,2*n-4]
        others = list(range(1,2*n-4))
    else:
        center = [x+1,x,x-1,x+2]
        others = list(range(1,x-1)) + list(range(x+3,2*n))
    split_idx = n-2
    result = others[:split_idx] + center + others[split_idx:]
    
    return result


res = get_result()
if len(res)==0:
    print("No")
else:
    print("Yes")
    for r in res:
        print(r)
        

### FIXED CODE ###

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

def get_result():
    if x == 1 or x == 2*n-1:
        return []
    
    if n == 2:
        return [1,2,3]
    
    if x == 2:
        center = [3,2,1,4]
        others = list(range(5,2*n))
    elif x == 2*n-2:
        center = [2*n-3,2*n-2,2*n-1,2*n-4]
        others = list(range(1,2*n-4))
    else:
        center = [x+1,x,x-1,x+2]
        others = list(range(1,x-1)) + list(range(x+3,2*n))
    split_idx = n-2
    result = others[:split_idx] + center + others[split_idx:]
    
    return result


res = get_result()
if len(res)==0:
    print("No")
else:
    print("Yes")
    for r in res:
        print(r)
x, y = map(int, input().split())
ans += max(0, (4-x)*100000)
ans += max(0, (4-y)*100000)
if x == 1 and y == 1:
	ans += 400000
print(ans)

### FIXED CODE ###

x, y = map(int, input().split())
ans = 0
ans += max(0, (4-x)*100000)
ans += max(0, (4-y)*100000)
if x == 1 and y == 1:
	ans += 400000
print(ans)
import bisect

n, m = map(int, input().split())
f_1 = []
t_n = []
jedge = 0
for i in range(m):
    a, b = map(int, input().split())
    if a == 1:
        f_1.append(b)
    if b == n:
        t_n.append(a)
f_1.sort()
t_n.sort()
for i in range(len(f_1)):
    p = bisect.bisect_left(t_n, f_1[i])
    if p != len(t_n)-1 and f_1[i] == t_n[p+1]:
        jedge = 1
        break
    elif p == len(t_n)-1 and f_1[i] == t_n[p]:
        jedge = 1
        break
if jedge == 1:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")


### FIXED CODE ###

import bisect

n, m = map(int, input().split())
f_1 = []
t_n = []
jedge = 0
for i in range(m):
    a, b = map(int, input().split())
    if a == 1:
        f_1.append(b)
    if b == n:
        t_n.append(a)
f_1.sort()
t_n.sort()
for i in range(len(f_1)):
    p = bisect.bisect_left(t_n, f_1[i])
    if p < len(t_n)-1 and f_1[i] == t_n[p]:
        jedge = 1
        break
    elif p == len(t_n)-1 and f_1[i] == t_n[p]:
        jedge = 1
        break
if jedge == 1:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
R=input()
print(R*3.14)

### FIXED CODE ###

print(3.1415*int(input())*2)
S=input()
n=len(S)
def T(i):
    if i == 0:
        return 0
    else:
        i-=1
        return T(i)+(10**i)*int(S[n-1-i])
s=[0]*2019
for j in range(1,n+1):
    print(T(j))
    m=T(j)%2019
    s[m]+=1

c=s[0]

for m in s:
    c += m*(m-1)/2

print(int(c))


### FIXED CODE ###

s = input()
p = 2019
n = 0
ans = 0
mods = [0]*p
mods[0] = 1
for i, j in enumerate(reversed(s)):
  n += int(j)*pow(10, i, p)
  n %= p
  mods[n] += 1
for i in mods:
  ans += i*(i-1)//2
print(ans)
n, m = map(int, input().split())
a = list(map(int, input().split()))

for i in range(m):
    max = 0
    for j in range(n):
        if max < a[j]:
            max = a[j]
            max_i = j
    a[max_i] = math.floor(a[max_i] / 2)
###    a[a.index(max(a))] = math.floor(a[a.index(max(a))] / 2)

print(sum(a))

### FIXED CODE ###

import heapq


n, m = map(int, input().split())
a = [-int(x) for x in input().split()]

heapq.heapify(a)

for i in range(m):
    t = -heapq.heappop(a)
    heapq.heappush(a, (t // 2) * (-1))

print(-sum(a))
N=int(input())
A=[]
D={}
count=0
for i in range(N):
    S=''.join(sorted(input()))
    A.append(S)

for s in A:
    if s in D:
        count+=1
    else:
        D+=s
print(count)

### FIXED CODE ###

N=int(input())
A=[]
D={}
cnt=0
for i in range(N):
    A.append(str(sorted(input())))

for sortstr in A:
    if sortstr in D:
        cnt+=D[sortstr]
        D[sortstr]+=1
    else:
        D[sortstr]=1
print(cnt)
a,b= i for i in input().split()
for i in range(100):
	if int(a+b)/(i*i)==1:
      print("Yes")
print("No")

### FIXED CODE ###

a,b=(i for i in input().split())
tmp=int(a+b)
if tmp**0.5==int(tmp**0.5):
  print("Yes")
else:
  print("No")
import math
PI = math.pi
r = int(input())

s = r * r * PI
l = 2 * PI * r

print(s, l)

### FIXED CODE ###

# -*- coding: utf-8 -*-

import sys
import os
import math
PI = math.pi

r = float(input())

s = r * r * PI
l = 2 * PI * r

print(s, l)
N = int(input())
sum = 0
for i in range[1,N+1]:
  if len(i) // 2:
    i += 1
  else:
    sum += 1
    i += 1
print(sum)

### FIXED CODE ###

N = int(input())
sum = 0
for i in range(1,N+1):
  if len(str(i)) % 2 == 1:
    sum += 1
print(sum)
X=input("入力1")
t=input("入力2")
 
y=X-t
 
print(max(y,0))

### FIXED CODE ###

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

print(max(x-t,0))
from statistics import mean, median,variance,stdev
import numpy as np
import sys
import math
import fractions

def j(q):
    if q==1: print("Yes")
    else:print("No")
    exit(0)


def ct(x,y):
    if (x>y):print("")
    elif (x<y): print("")
    else: print("")

def ip():
    return int(input())


#n = ip()                              #入力整数1つ
x,y= (int(i) for i in input().split())      #入力整数横2つ
#n,x,y = (int(i) for i in input().split())    #入力整数横3つ
#n,m,x,y= (int(i) for i in input().split())  #入力整数横4つ
a = [int(i) for i in input().split()]        #入力整数配列
#a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列
#n = ip()                      #入力セット(整数改行あり)(1/2)
#a=[ip() for i in range(n)]    #入力セット(整数改行あり)(2/2)

#jの変数はしようできないので注意
#全足しにsum変数使用はsum関数使用できないので注意
s = []
if x == 1:
    print(a[0])
    exit(0)
for i in range(x-y):
    c = a[i]
    d = a[i+y-1]

    if c*d < 0:
        s.append(d-c + min(abs(c),abs(d)))
    elif  d < 0:
        s.append(abs(c))
    else: s.append(d)
print(min(s))

### FIXED CODE ###

from statistics import mean, median,variance,stdev
import numpy as np
import sys
import math
import fractions

def j(q):
    if q==1: print("Yes")
    else:print("No")
    exit(0)


def ct(x,y):
    if (x>y):print("")
    elif (x<y): print("")
    else: print("")

def ip():
    return int(input())


#n = ip()                              #入力整数1つ
x,y= (int(i) for i in input().split())      #入力整数横2つ
#n,x,y = (int(i) for i in input().split())    #入力整数横3つ
#n,m,x,y= (int(i) for i in input().split())  #入力整数横4つ
a = [int(i) for i in input().split()]        #入力整数配列
#a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列
#n = ip()                      #入力セット(整数改行あり)(1/2)
#a=[ip() for i in range(n)]    #入力セット(整数改行あり)(2/2)

#jの変数はしようできないので注意
#全足しにsum変数使用はsum関数使用できないので注意
s = []
if x == 1:
    print(a[0])
    exit(0)
if x == y:
    c = a[0]
    d = a[x-1]
    if c*d < 0:
        s.append(d-c + min(abs(c),abs(d)))
    elif  d <= 0:
        s.append(abs(c))
    else: s.append(d)
for i in range(x-y+1):
    c = a[i]
    d = a[i+y-1]
    if c*d < 0:
        s.append(d-c + min(abs(c),abs(d)))
    elif  d <= 0:
        s.append(abs(c))
    else: s.append(d)
print(min(s))
n=input()
result=''
for i in n:
    if i==1:
        result+=9
    else:
        result+=1
print(result)

### FIXED CODE ###

n=input()
result=''
for i in n:
    if i=='1':
        result+='9'
    else:
        result+='1'
print(result)
def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    """
    h, n, w <= 3500
    4*h*n*w/(h*n+n*w+h*w) = N
    n*w+h*w = (n+h)*w = k*h*n  => k = (n+h)*w/(h*n)

    4hnw/(k+1)hn=4w/(k+1) = N
    """
    N = read_int()
    for w in range(1, 3501):
        if (4*w)%N == 0:
            k = (4*w)//N-1
            for n in range(1, 3501):
                if k*n-w != 0 and (n*w)%(k*n-w) == 0:
                    h = n*w//(k*n-w)
                    if h > 0:
                        print(f'{N}=4*{h}*{n}*{w}/({h}*{n}+{n}*{w}+{h}*{w})')
                        return h, n, w


if __name__ == '__main__':
    print(*solve())


### FIXED CODE ###



def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    """
    h, n, w <= 3500
    4/N = 1/h+1/n+1/w
    1/h = 4/N-1/n-1/w = 4nw-Nw-Nn / Nnw
    """
    N = read_int()
    for w in range(1, 3501):
        for n in range(1, 3501):
            if (4*n*w-N*w-N*n) != 0 and (N*n*w)%(4*n*w-N*w-N*n) == 0:
                h = (N*n*w)//(4*n*w-N*w-N*n)
                if h > 0:
                    return h, n, w


if __name__ == '__main__':
    print(*solve())
l = map(int, raw_input().split())
if l[0] > l[1]:
    print "a > b"
elif l[0] = l[1]:
    print "a == b"
else:
    print "a < b"

### FIXED CODE ###

l = map(int, raw_input().split())
if l[0]>l[1]:
    print "a > b"
elif l[0]==l[1]:
    print "a == b"
else:
    print "a < b"
while True:

 (m, f, r) = [int(i)for i in input().split()]
 if m == f == -1:
    break

   total = m + f
   if m == -1 or == -1 or total < 30:
      print('F')
    elif total < 50 and r < 50:
    print('D')
    elif total < 65:
    print('C')
    elif total < 80:
    print('B')
   else:
     print('A') 

### FIXED CODE ###

while True:
    m, f, r = map(int, input().strip().split())
    if m == f == r == -1: break
    if m == -1 or f == -1 or m + f < 30:
        print('F')
    elif m + f >= 80:
        print('A')
    elif m + f >= 65:
        print('B')
    elif m + f >= 50:
        print('C')
    elif m + f >= 30:
        print('C' if r >= 50 else 'D')
# AOJ TP2_2_A: Stack
# Python3 2018.6.24 bal4u

from collections import deque
n, q = map(int, input().split())
Q = []
for i in range(n): Q.append(deque())
for i in range(q):
	a = input().split()
	t = int(a[1])
	if   a[0] == '0': Q[t].append(a[2])   # push
	elif a[0] == '1': print(Q[t][-1])     # top
	else: Q[t].pop()                      # pop



### FIXED CODE ###

# AOJ TP2_2_A: Stack
# Python3 2018.6.24 bal4u

from collections import deque
n, q = map(int, input().split())
Q = []
for i in range(n): Q.append(deque())
for i in range(q):
	a = input().split()
	t = int(a[1])
	if   a[0] == '0': Q[t].append(a[2])        # push
	elif a[0] == '1' and Q[t]: print(Q[t][-1]) # top
	elif a[0] == '2' and Q[t]: Q[t].pop()      # pop