Harryxun/stf_run huggingface dataset:
a=input()
a=int(a)
d=a
if a<2:
    b=a
    a=2
while c!=0:
    c=a%b
    a=b
    b=c
print(d*2/b)


### FIXED CODE ###

N=input()
N=int(N)
if N%2==0:
    print(N)
else:
    print(N*2)
class Node:
    def __init__(self, id):
        self.id = id
        self.node1 = 0
        self.node2 = 0
        self.val = 0

    def set_node(self, node):
        if self.node1 == 0:
            self.node1 = node
        else:
            self.node2 = node


def add_val(node, val):
    global tree
    if node.id == 0:
        return
    node.val += val
    add_val(tree[node.node1], val)
    add_val(tree[node.node2], val)


n, q = map(int, input().split())
tree = [Node(id) for id in range(n + 1)]

for i in range(n - 1):
    a, b = map(int, input().split())
    tree[a].set_node(b)

for i in range(q):
    p, x = map(int, input().split())
    add_val(tree[p], x)

for i in range(1, n + 1):
    if i != 1:
        print(" ", end="")
    print(tree[i].val, end="")
print("")


### FIXED CODE ###

import sys

input = sys.stdin.readline


class Node:
    def __init__(self, parent_id=None):
        self.val = 0
        self.parent_id = parent_id


n, q = map(int, input().split())
tree = [Node() for _ in range(n)]

for _ in range(1, n):
    a, b = map(int, input().split())
    tree[b - 1].parent_id = a - 1

for _ in range(q):
    p, x = map(int, input().split())
    tree[p - 1].val += x

for i in range(1, n):
    tree[i].val += tree[tree[i].parent_id].val

print(*[node.val for node in tree])
from sys import stdin
N = int(stdin.readline().rstrip())
s = stdin.readline().rstrip()
sum = 0
wh = s.count('.')
cnt = 0
for itr in range(N):
    if s[itr] == '#':
        cnt += 1
        continue
    if cnt > 0:
        sum += 1
        cnt -= 1
print(sum)


### FIXED CODE ###

from sys import stdin
s_data = stdin.readline().rstrip().split()
data = [int(itr) for itr in s_data]
A = data[0]
B = data[1]
C = data[2]
if (B <= C and C <= A) or (A <= C and C <= B):
    print('Yes')
else:
    print('No')
from math import sqrt
a,b,c =(map(int,input().split()))
left = a+ b + 2*sqrt(a*b)
right = c
if left < right:
    print('Yes')
else :
    print('No')

### FIXED CODE ###

array = [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]
k = int(input())
print(array[k-1])
N=int(input())
A=list(map(int,input().split()))
count=0
while all(a%2==0 for a in A):
  A=[a/2 for a in A]
  count+=1
print(count)

### FIXED CODE ###

N=input()
print(N.count("1"))
N, K, X, Y = map(int, input().split())

if N <= K:
    print(N * X)
else:
    print(K * X + (N - K) * Y)

### FIXED CODE ###

N = int(input())   
K = int(input())   
X = int(input())    
Y = int(input())    

if N <= K:
    print(N * X)
else:
    print(K * X + (N - K) * Y)
n, a, b = map(int, input().split(" "))

s = ''

while(len(s)<=n):

    s+= 'A' * a
    s+= 'B' * b

print(list(s)[:n].count('A'))

### FIXED CODE ###

n, a, b = map(int, input().split(" "))
c = a + b
if n % c == 0:
    print((n // c) * a)

else:
    q = n % c
    q = a if q > a else q
    print((n // c) * a + q)
import math
n = int(input())
x = []
y = []
sum = 0
for i in range(n):
    x1,y1=[int(i) for i in input().split()]
    x.append(x1)
    y.append(y1)
for i in range(3):
    for j in  range(3):
        sum += math.sqrt((x[i]-x[j])**2+(y[i]-y[j])**2)
average  = 2*sum/(math.factorial(n))
print(average)


### FIXED CODE ###

import math
n = int(input())
x = []
y = []
sum = 0
for i in range(n):
    x1,y1=[int(i) for i in input().split()]
    x.append(x1)
    y.append(y1)
for i in range(n):
    for j in  range(n):
        sum += math.sqrt((x[i]-x[j])**2+(y[i]-y[j])**2)
average  = (math.factorial(n)/n)*sum/(math.factorial(n))
print(average)
N, M = list(map(int, input().split()))
A = set(int(input()) for i in range(M))
x = [0] * (n+1)
x[0] = 1

for i in range(1, n+1): 
  if x[i] in A:
    x[i] = 0
  else:
    x[i] = (x[i-1] + x[i-2])%(10**9+7)
return x[n]

### FIXED CODE ###

N, M = map(int, input().split())
A = set(int(input()) for i in range(M))
x = [0] * (N+1)
x[0] = 1
 
for i in range(1, N+1): 
  if i in A: x[i] = 0
  else:
    x[i] = (x[i-1] + x[i-2])%(10**9+7)
    
print(x[N])
# O(n^M) -> TLE
from itertools import product
N, M, Q = map(int, input().split())
ls = []
for i in range(Q):
    ls.append([int(j) for j in input().split()])
arr = list(range(1, M+1))
ans = 0
for x in product(arr, repeat=N):
    cur = 0
    for y in ls:
        if x[y[1]-1] - x[y[0]-1] == y[2]:
            cur += y[3]
    ans = max(ans, cur)
print(ans)

# DFS
from collections import deque
N, M, Q = map(int, input().split())
ls = []
for i in range(Q):
    ls.append([int(j) for j in input().split()])
arr = list(range(1, M+1))
ans = 0
for i in range(1, M+1):
    st = deque([])
    st.append((i, str(i)))
    while st:
        p, l = st.pop()
        if len(l) == N:
            cur = 0
            for y in ls:
                if int(l[y[1]-1]) - int(l[y[0]-1]) == y[2]:
                    cur += y[3]
            ans = max(ans, cur)
        else:
            for j in range(p, M+1):
                st.append((j, l + str(j)))
print(ans)

# 数列生成
from itertools import combinations
N, M, Q = map(int, input().split())
ls = []
for i in range(Q):
    ls.append([int(j) for j in input().split()])
V = [[] for i in range(N+1)]
for i in range(1, M+1):
    V[1].append([i])

for i in range(1, N):
    for v in V[i]:
        b = v[-1]
        for x in range(b, M+1):
            V[i+1].append(v + [x])
ans = 0
for x in V[-1]:
    cur = 0
    for z in ls:
        if x[z[1]-1] - x[z[0]-1] == z[2]:
            cur += z[3]
    ans = max(ans, cur)
print(ans)

### FIXED CODE ###

# 数列生成
from itertools import combinations
N, M, Q = map(int, input().split())
ls = []
for i in range(Q):
    ls.append([int(j) for j in input().split()])
V = [[] for i in range(N+1)]
for i in range(1, M+1):
    V[1].append([i])

for i in range(1, N):
    for v in V[i]:
        b = v[-1]
        for x in range(b, M+1):
            V[i+1].append(v + [x])
ans = 0
for x in V[-1]:
    cur = 0
    for z in ls:
        if x[z[1]-1] - x[z[0]-1] == z[2]:
            cur += z[3]
    ans = max(ans, cur)
print(ans)
import math
"""
def search(min_,max_,A,B,arr):
#    print(min_,max_)
    if min_==max_:
        return min_
    mid=(max_+min_)//2
    
    tmp=arr-mid*B
    
    if len(tmp)==0:
        return search(min_,mid,A,B,arr)
    
    tmp=map(lambda x:math.ceil(x/(A-B)),tmp)
    sum_=sum(list(tmp))
    if sum_<=mid:
        return search(min_,mid,A,B,arr)
    else:
        return search(mid+1,max_,A,B,arr)

    while True:
        if k<0:
            if mid==min_:
                return max_
            else:
                #failure
                return search(mid,max_,A,B,arr[:L])
        elif len(tmp)==0:
            #success
            return search(min_,mid,A,B,arr)
        x=-tmp[0]
        tmp=np.delete(tmp,0)
        k-=x//(A-B)+(x%(A-B)>0)
"""
        
    
N,A,B=list(map(int,input().split()))
arr=[]

for i in range(N):
    h=int(input())
    arr.append(h)

max_=max(arr)//B+1
min_=min(arr)//A

d=A-B

while min_!=max_:
    mid=(max_+min_)//2
    
    tmp=arr-mid*B
    
    sum_=0
    for x in tmp:
        sum_+=math.ceil(x/d)
    
    if sum_<=mid:
        max_=mid
    else:
        min_=mid+1

print(min_)

### FIXED CODE ###

import math
"""
def search(min_,max_,A,B,arr):
#    print(min_,max_)
    if min_==max_:
        return min_
    mid=(max_+min_)//2
    
    tmp=arr-mid*B
    
    if len(tmp)==0:
        return search(min_,mid,A,B,arr)
    
    tmp=map(lambda x:math.ceil(x/(A-B)),tmp)
    sum_=sum(list(tmp))
    if sum_<=mid:
        return search(min_,mid,A,B,arr)
    else:
        return search(mid+1,max_,A,B,arr)

    while True:
        if k<0:
            if mid==min_:
                return max_
            else:
                #failure
                return search(mid,max_,A,B,arr[:L])
        elif len(tmp)==0:
            #success
            return search(min_,mid,A,B,arr)
        x=-tmp[0]
        tmp=np.delete(tmp,0)
        k-=x//(A-B)+(x%(A-B)>0)
"""
        
    
N,A,B=list(map(int,input().split()))
arr=[]

for i in range(N):
    arr.append(int(input()))

max_=max(arr)//B+1
min_=min(arr)//A

d=A-B

while min_!=max_:
    mid=(max_+min_)//2
    
    sum_=0
    for x in arr:
        sum_+=max(0,math.ceil((x-mid*B)/d))
        
    if sum_<=mid:
        max_=mid
    else:
        min_=mid+1

print(min_)
n=int(input())
arr=[input() for _ in range(n)]
count=0
if arr.count('P')!=0:
  count+=1
if arr.count('Y')!=0:
  count+=1
if arr.count('W')!=0:
  count+=1
if arr.count('G')!=0:
  count+=1
if count==3:
  print('Three')
if count==4:
  print('Four')

### FIXED CODE ###

n=int(input())
arr=list(map(str,input().split()))
count=0
if arr.count('P')!=0:
  count+=1
if arr.count('Y')!=0:
  count+=1
if arr.count('W')!=0:
  count+=1
if arr.count('G')!=0:
  count+=1
if count==3:
  print('Three')
if count==4:
  print('Four')
L = map(str, input())

s = L[0]
S = list(s)
t = L[1]
T = list(t)

N = len[S]
i = 1

while N != i:
    if S[i] != T[i]:
        S[i] = T[i]
        i += 1

### FIXED CODE ###

s,t = input(), input()

S = list(s)
T = list(t)

N = len(s) - 1
i = 0
counter = 0

while N + 1 != i:
    if S[i] != T[i]:
        S[i] = T[i]
        counter += 1
    i += 1

print(counter)
n, k = map(int, input().split())
v = list(map(int, input().split()))
ans = 0

for l in range(k + 1):
	for r in range(k - l + 1):
		hand = []
		#handに左からl個
		hand = v[: l]
        #右からr個の要素を追加
		hand.extend(v[n - r:])
        #現時点でのhandの和をhand_sum
		hand_sum = sum(hand)  
		hand.sort()
        #hand_sum中の負の要素を詰めていく
		for i in range(min(hand.sort())):
			if hand[i] < 0:
			  hand_sum -= hand[i]
		ans = max(ans, hand_sum)

print(ans)

### FIXED CODE ###

n, k = map(int, input().split())
v = list(map(int, input().split()))
ans = 0

for l in range(k + 1):
	for r in range(k - l + 1):
		hand = []
		if l + r > n:
			break
        #handに左からl個
		hand = v[: l]
        #右からr個の要素を追加
		hand.extend(v[n - r:])
        #現時点でのhandの和をhand_sum
		hand_sum = sum(hand)  
		hand.sort()
        #hand_sum中の負の要素を詰めていく
		for i in range(min(k - l - r, l + r)):
			if hand[i] < 0:
			  hand_sum -= hand[i]
		ans = max(ans, hand_sum)

print(ans)
def repaint(h, w):
    s = [[['.']*(w+2)]+[list('.'+input()+'.') for i in range(h)]+[['.']*(w+2)]]
    for i in (1, h+1):
        for p in (1, w+1):
            if s[i][p] == '#':
                if s[i-1][p] == s[i][p-1] == s[i+1][p] == s[i][p+1] == '.':
                    return 'No'
    return 'Yes'
H, W = map(int, input().split())
print(repaint(H, W))

### FIXED CODE ###

import numpy as np
def repaint(h,w,s):
    for i in range(1,h+1):
        for p in range(1,w+1):
            if s[i][p] == '#':
                if (s[i-1][p] != '#') and (s[i][p-1] != '#') and (s[i+1][p] != '#') and (s[i][p+1] != '#'):
                    return 'No'
    return 'Yes'
H, W = map(int, input().split())
S = np.array([['0']*(W+2)] + [list('0' + input() + '0') for i in range(H)] +[['0']*(W+2)])
print(repaint(H,W,S))
l = int(input().split())
print(l(0) * l(1) - (l(0) + l(1) -1))

### FIXED CODE ###

a, b = map(int, input().split())
 
print((a - 1) * (b - 1))
s = input()
k = int(input())
result = []
for i in range(min(len(s),k)):
  result = result + [s[j:j+i+1] for j in range(len(s)-i)]
  
result = sorted(set(result))
print(result[3])

### FIXED CODE ###

s = input()
k = int(input())
result = []
for i in range(min(len(s),k)):
  result = result + [s[j:j+i+1] for j in range(len(s)-i)]
  
result = sorted(set(result))
print(result[k-1])
n = int(input())
x = input()
pop = x.count("1")
lst1 = [1]
for i in range(n-1):
    lst1.append(lst1[-1] * 2 % (pop + 1))
lst1.reverse()
num1 = 0
for i in range(n):
    if x[i] == "1":
        num1 += lst[i]
        num1 %= (pop + 1)
if pop == 1 or pop == 2:
    lst2 = [0] * n
else:
    lst2 = [1]
    for i in range(n-1):
        lst2.append(lst2[-1] * 2 % (pop - 1))
    lst.reverse()
    num2 = 0
    for i in range(n):
        if x[i] == "1":
            num2 += lst2[i]
            num2 %= (pop - 1)
x2 = int(x, 2)
for i in range(n):
    if x[i] == "1":
        if pop == 1:
            print(0)
            continue
        elif pop == 2:
            print(1)
            continue
        else:
            num = num2 - lst2[i]
            num %= (pop - 1)
    else:
        num = num1 + lst1[i]
        num %= (pop + 1)
    count = 1
    while num:
        num %= bin(num).count("1")
        count += 1
    print(count)

### FIXED CODE ###

n = int(input())
x = input()
pop = x.count("1")
lst1 = [1]
for i in range(n-1):
    lst1.append(lst1[-1] * 2 % (pop + 1))
lst1.reverse()
num1 = 0
for i in range(n):
    if x[i] == "1":
        num1 += lst1[i]
        num1 %= (pop + 1)
if pop == 1 or pop == 2:
    lst2 = [0] * n
else:
    lst2 = [1]
    for i in range(n-1):
        lst2.append(lst2[-1] * 2 % (pop - 1))
    lst2.reverse()
    num2 = 0
    for i in range(n):
        if x[i] == "1":
            num2 += lst2[i]
            num2 %= (pop - 1)
x2 = int(x, 2)
for i in range(n):
    if x[i] == "1":
        if pop == 1:
            print(0)
            continue
        elif pop == 2:
            print(1)
            continue
        else:
            num = num2 - lst2[i]
            num %= (pop - 1)
    else:
        num = num1 + lst1[i]
        num %= (pop + 1)
    count = 1
    while num:
        num %= bin(num).count("1")
        count += 1
    print(count)
input_num = input()

if input_num != 1:
    a = int(input())
    b = int(input())
    print(a + b)
else:
    print('Hello World')

### FIXED CODE ###

input_num = input()

if input_num == '1':
    print('Hello World')

else:
    a = int(input())
    b = int(input())
    print(a + b)
while True:
    H, W = [int(i) for i in input().split]
    if H == W == 0:
        break

    for h in range(H):
        for w in range(W):
            if(h + w) % 2 == 0:
                print('#', end='')
            else:
                print('.', end='')

        print()

### FIXED CODE ###

while True:
    H, W = [int(i) for i in input().split()]
    if H == W == 0:
        break

    for h in range(H):
        for w in range(W):
            if (h + w) % 2 == 0:
                print('#', end='')
            else:
                print('.', end='')

        print()
    print()
n = int(input())
arr = list(int,input().split())
def mod(i): return i%2==1
lst = list(filter(lambda x: mod(x),arr[::2]))
print(len(lst))

### FIXED CODE ###

n = int(input())
arr = list(map(int,input().split()))
def odd(n) : return (n%2==1)
lst = list(filter(odd,arr[0:n:2]))
print(len(lst))
from collections import Counter
n, k = map(int, input().split())
A = list(map(int, input().split()))
C = Counter([])
X, Y = [], []
m = 0
for _ in range(n):
    a = A[m]-1
    C[m] += 1
    X.append(m)
    if C[a] != 0:
        Y = X[X.index(a):]
        X = X[:X.index(a)]
        break
    m = a
# print(X,Y)
x=len(X)
y=len(Y)
if k <= x:
    print(X[k]+1)
else:
    k -= x
    print(Y[k-(k//y)*y]+1)


### FIXED CODE ###

from collections import Counter
n, k = map(int, input().split())
A = list(map(int, input().split()))
C = Counter([])
X, Y = [], []
m = 0
for _ in range(n):
    a = A[m]-1
    C[m] += 1
    X.append(m)
    if C[a] != 0:
        Y = X[X.index(a):]
        X = X[:X.index(a)]
        break
    m = a
# print(X,Y)
x = len(X)
y = len(Y)
if k <= x-1:
    print(X[k]+1)
else:
    k -= x
    print(Y[k-(k//y)*y]+1)
import math
A,B,C,D = map(int, input().split())

k = B - A + 1

if A%C == 0:
    sc = B//C -A//C +1
else:
    sc = B//C -A//C

if A%D == 0:
    sd = B//D -A//D +1
else:
    sd = B//D -A//D    
    

cd = C*D/math.gcd(C,D)

if A%D == 0:
    scd = B//cd -A//cd +1
else:
    scd = B//cd -A//cd    

print(int(k + scd -sc -sd))
      

### FIXED CODE ###

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

k = B - A + 1

if A%C == 0:
    sc = B//C -A//C +1
else:
    sc = B//C -A//C

if A%D == 0:
    sd = B//D -A//D +1
else:
    sd = B//D -A//D    
    

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

cd = C*D//gcd(C,D)

if A%cd == 0:
    scd = B//cd -A//cd +1
else:
    scd = B//cd -A//cd    

print(int(k + scd -sc -sd))
a, b=map(int, input().split())
if a-2*b>=0:
    print(a-2b)
else:
    print(0)

### FIXED CODE ###

a, b=map(int, input().split())
if a-2*b>=0:
    print(a-2*b)
else:
    print(0)
N, M = [int(_) for _ in input().split()]
AB = [[int(_) for _ in input().split()] for i in range(N - 1 + M)]

import sys
sys.setrecursionlimit(100010)

from collections import defaultdict

vs = defaultdict(set)

for a, b in AB:
    vs[b].add(a)

from functools import lru_cache

@lru_cache(maxsize=N)
def calc(n):
    max_distance = 0
    max_distance_parent = 0
    for m in vs[n]:
        d = calc(m)[0]
        if max_distance < d + 1:
            max_distance = d + 1
            max_distance_parent = m
    return max_distance, max_distance_parent

for i in range(1, N + 1):
    print(calc(i)[1])


### FIXED CODE ###

N, M = [int(_) for _ in input().split()]
AB = [[int(_) for _ in input().split()] for i in range(N - 1 + M)]

import sys
sys.setrecursionlimit(200000)

from collections import defaultdict

vs = defaultdict(set)
ws = defaultdict(set)

for a, b in AB:
    vs[a].add(b)
    ws[b].add(a)

#print(vs)
#print(ws)

L = []

cs = [0] * (1 + N)

def visit(n):
    if cs[n] == 1:
        return
    elif cs[n] == 0:
        cs[n] = 1
        for m in vs[n]:
            visit(m)
        cs[n] = 2
        L.append(n)

for n in range(1, N + 1):
    if cs[n] == 0:
        visit(n)

#print(L)

nrank = {}

for r, n in enumerate(L):
    nrank[n] = r

#print(nrank)

for n in range(1, N + 1):
    r = 0
    if ws[n]:
        r = sorted(ws[n], key=lambda x:nrank[x])[0]
    print(r)
#!/usr/bin/python
# coding: UTF-8


#import scipy.optimize
import math

    
##################################################################

if __name__ == "__main__":

    Input = [input() for i in range(2)]
    N,M = list(map(int,Input[0].split()))
    A = list(map(int,Input[1].split()))
    A.sort(reverse=True)

    if N==1:
        Money = math.floor(A[0]/(2**M))
        print(Money)
    else:      
        Use = 0
        while Use < M:
            if A[0] == A[1]:
                Usenow = 1
            else:
                Usenow = math.ceil(math.log2(A[0])-math.log2(A[1]))
            Use += Usenow
            if Use > M:
                Usenow -= Use - M
            temp = math.floor(A[0]/(2**Usenow))
            for i in range(1,N):
                if temp < A[i]:
                    A[0:i] = A[1:i+1]
                    A[i] = temp
                    break
                else:
                    continue
        print(sum(A))                            


### FIXED CODE ###

# coding: UTF-8

#import scipy.optimize
from math import ceil,floor
from heapq import heappush, heappop, heapify
    
##################################################################

if __name__ == "__main__":

    Input = [input() for i in range(2)]
    N,M = list(map(int,Input[0].split()))
    A = list(map(int,Input[1].split()))
    A = [-a for a in A]
    heapify(A)
    Use = 0
    while Use < M:
        temp = -1*heappop(A)
        temp = floor(temp/2)
        heappush(A, -temp)
        Use += 1
    print(sum(A)*-1)
N = input()
s = 0
 for i in range(0,len(N)):
  if N[i] == "o":
    s = s + 1
print(700 + 100 * s)    


### FIXED CODE ###

A = input()
B = A.count('o')
print(700+int(B)*100)
a,b = map(int,input().split())
if a < b:
    print('a < b')
elif a > b:
    print('a > b')
elif: a == b
    print('a == b')

### FIXED CODE ###

a,b = map(int,input().split())
if a < b:
    print('a < b')
elif a > b:
    print('a > b')
else:
    print('a == b')
W,H,x,y=map(int,input().split())
if x==W/2 and y==H/2:
  print(float(W*H/2),1)
elif x==W/2 and (not y==H/2):
  print(float(W*H/2),0)
elif (not x==W/2) and y==H/2:
  print(float(W*H/2),0)
else:
  if H/W==y/x or W/H==-(y/x):
    print(float(W*H/2),0)
  else:
    print(float(W*H/2),0)
    
 

### FIXED CODE ###

W,H,x,y=map(int,input().split())
if x==W/2 and y==H/2:
  print(float(W*H/2),1)
else:
  print(float(W*H/2),0)
n = int(input())
al = list(map(int,input().split()))

MOD = 10**9 + 7
N = 10**5

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

# nPk (mod MOD) を求める
def perm(n, k):
  return fact[n] * rfact[n-k] % MOD

# nCk (mod MOD) を求める
def comb(n, k):
  return fact[n] * rfact[k] * rfact[n-k] % MOD

from collections import defaultdict
dic = defaultdict(int)

v = 0
s = 0
e = 0
for idx, a in enumerate(al):
    if dic[a] == 1:
        e = idx
        v = a
    dic[a] += 1

for idx, a in enumerate(al):
    if a == v:
        s = idx
        break


for i in range(1, n+2):
    ans = comb(n+1, i)
    if s + n - e >= i - 1:
        ans -= comb(s+(n-e), i-1)
    ans %= MOD
    print(ans)




### FIXED CODE ###

n = int(input())
al = list(map(int,input().split()))

MOD = 10**9 + 7
N = 10**5+1

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

# nPk (mod MOD) を求める
def perm(n, k):
  return fact[n] * rfact[n-k] % MOD

# nCk (mod MOD) を求める
def comb(n, k):
  return fact[n] * rfact[k] * rfact[n-k] % MOD

from collections import defaultdict
dic = defaultdict(int)

for idx, a in enumerate(al):
    if dic[a] == 1:
        e = idx
        v = a
    dic[a] += 1

for idx, a in enumerate(al):
    if a == v:
        s = idx
        break


for i in range(1, n+2):
    ans = comb(n+1, i)
    if s + n - e >= i - 1:
        ans -= comb(s+(n-e), i-1)
    ans %= MOD
    print(ans)
from numba import njit
import numpy as np


def main(N, P):
    d = np.zeros((N, N), dtype=np.int32)
    d = d.ravel()
    sit = np.ones_like(d)
    que = []
    count = 0
    for i in range(N*N):
        d[i] = min(i % N, (N-1-i) % N, i//N, N-1-i//N)
    for player in P:
        sit[player-1] = 0
        count += d[player-1]
        que.append(player)
        for p in que:
            for i in (1, -1, N, -N):
                if p+i < 1 or p + i > N*N:
                    continue
                if d[p-1]+sit[p-1] < d[p+i-1]:
                    d[p+i-1] = d[p-1]+sit[p-1]
                    que.append(player+i)
    print(count)


def cc_export():
    from numba.pycc import CC
    cc = CC('my_module')
    cc.export('main', 'i8,i8[:]')(main)
    cc.compile()


if __name__ == '__main__':
    import sys
    if sys.argv[-1] == 'ONLINE_JUDGE':
        cc_export()
        exit(0)
    from my_module import main
    N = int(input())
    P = map(int, input().split())
    main(N, P)


### FIXED CODE ###

from numba import njit
import numpy as np

@njit
def main(N, P):
    lista = [1, -1, N, -N]
    d = np.zeros((N, N), dtype=np.int32)
    d = d.ravel()
    sit = np.ones_like(d)
    stack = np.empty_like(d)
    count = 0
    for i in range(N*N):
        d[i] = min(i % N, (N-1-i) % N, i//N, N-1-i//N)
    for player in P:
        sit[player-1] = 0
        count += d[player-1]
        stack[0] = player
        num = 0
        while num >= 0:
            p = stack[num]
            num -= 1
            a = d[p-1]+sit[p-1]
            for i in lista:
                if p+i < 1 or p + i > N*N:
                    continue
                if d[p+i-1] > a:
                    d[p+i-1] = a
                    num += 1
                    stack[num] = p+i
    print(count)

N = int(input())
P = np.array(input().split(), np.int32)

main(N, P)
A = int(input())
B = int(input())
print(A * B)

### FIXED CODE ###

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