Harryxun/stf_run huggingface dataset:
A,B = map(int,input().split())
k=(A**2-B**2)/(2*A-2*B)
if k == int(k):
  print(int(k))
else:
  print(IMPOSSIBLE)
    

### FIXED CODE ###

A,B = map(int,input().split())
k=(A**2-B**2)/(2*A-2*B)
if k == int(k):
  print(int(k))
else:
  print("IMPOSSIBLE")
a = int(input())
if a == a[::-1]:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

a = input()
if a[0] == a[2]:
  print('Yes')
else:
  print('No')
def main():
    alpha=[int(intput()) for_in range(5)]
    k=int(intput())
    for a in alpha:
        for b in alpha:
            if abs(a-b)>k:
                print (':(')
                exit()
    print('Yay!')
                

### FIXED CODE ###

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


def main():
    alpha = [int(input()) for _ in range(5)]
    k = int(input())

    for a in alpha:
        for b in alpha:
            if abs(a - b) > k:
                print(':(')
                exit()

    print('Yay!')


if __name__ == '__main__':
    main()
a,b = map(int ,input().split())
if(a*b%2==0):
	return("Even")
return("Odd")

### FIXED CODE ###

a, b = map(int,input().split())
if(a*b)%2==0:
	print("Even")
else:
	print("Odd")
import collections

S = input()
K = int(input())

tmp = []
cum_p = [0.0]

for s in S:
    tmp.append(int(s))
total = sum(tmp)

for p in tmp:
    cum_p.append(cum_p[-1] + (p / total))

prob = K / (5*10e16)

for i in range(1, len(S) + 1):
    if prob < cum_p[i]:
        if S[i-1] == '1':
            print(S[i])
        else:
            print(S[i-1])
        break


### FIXED CODE ###

S = input()
K = int(input())

for i, s in enumerate(S):
    if s != '1' and K-1 < i:
        ans = '1'
        break
    elif s != '1' and K-1 >= i:
        ans = s
        break
else:
    ans = '1'
print(ans)
x = int(raw_input())
print("{0}".format(x^3))

### FIXED CODE ###

n=int(input())**3
print("{0}".format(n))
n,k=map(int,input().split())
a=list(map(int,input().split()))
a=[p-1 for p in a]
l=[0]
i=a[0]
p=-1
q=-1
for x in range(n):
    if i in set(l):break
    l.append(i)
    i=a[i]
d=-1
for x in range(n):
    if a[x]==i:
        d=x
        break
f=l[:d]
b=l[d:]
print(l,f,b,d)
if len(f)==0 or len(b)==0:
    print(l[k%(n-1)]+1)
    exit()

if k<=d:
    print(l[k]+1)
    exit()

k-=len(f)
print(b[k%len(b)]+1)

### FIXED CODE ###

n,k=map(int,input().split())
a=list(map(int,input().split()))
visited=[False]*(n+1)
visited[1]=True
l=[1]
i=a[0]

for x in range(n):
    if visited[i]:break
    visited[i]=True
    l.append(i)
    i=a[i-1]

d=-1
for x in range(n):
    if l[x]==i:
        d=x
        break

f=l[:d]
b=l[d:]

if len(f)==0:
    print(b[k%len(b)])
    exit()
 
if len(b)==0:
    print(f[k%len(f)])
    exit()

if k<=d:
    print(l[k])
    exit()
 
k-=len(f)
print(b[k%len(b)])
import bisect
import copy
n = int(input())
a = list(map(int, input().split()))
a.sort()
b = a.copy()
b.pop()
if len(b) == 1:
    idx = 0
else:
    if abs(a[-1]/2 - b[bisect.bisect_left(b, a[-1]/2)]) < abs(a[-1]/2 - b[bisect.bisect_right(b, a[-1]/2)]):
        idx = bisect.bisect_left(b, a[-1]/2)
    else:
        idx = bisect.bisect_right(b, a[-1]/2)
print(a[-1], b[idx])


### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
m = max(a)
a = sorted(a)
ans = 0
for i in a:
    if abs(m/2-i) < abs(m/2-ans):
        ans = i
print(m, ans)
N = int(input())
L = list(input())
most_highest_data = 0
ans = 0

for i in range(N):
    if int(L[i]) > most_highest_data:
            most_higest_data = L[i]
    if most_highest_data <= int(L[i+1]):
        ans += 1

print(ans)


### FIXED CODE ###

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

highest = L[0]
ans = 0

for i in range(N):
        if L[i] >= highest:
                ans += 1
                highest = L[i]

print(ans)
s = input()
n = len(s)
l = list("ACGT")
A = 0
for i in range(n):
  for j in range(i+1,n+1):
    x = s[i,j]
    if all(k in l for k in x):
      A = max(A,len(x))
print(A)

### FIXED CODE ###

s = input()
n = len(s)
l = list("ACGT")
A = 0
for i in range(n):
  for j in range(i+1,n+1):
    x = s[i:j]
    if all(k in l for k in x):
      A = max(A,len(x))
print(A)
N = int(input())
S = input()
S = S[::-1]

cnt = 0
# for i in range(1,N-1):
#     for j in range(i+1,N):
#         if S[i-1] != S[j-1]:
#             for k in range(j+1,N+1):
#                 if S[i-1]!=S[k-1] and S[j-1]!=S[k-1] and j-i!=k-j:
#                     cnt += 1
for i in range(1,N-1):
    for j in range(i+1,N):
        k = 2*j-i
        if S[i-1]==S[k-1] or S[j-1]==S[k-1] :
            cnt += 1


print(N**3-cnt)

### FIXED CODE ###



N = int(input())
S = input()
S = S[::-1]

cnt = S.count('B')*S.count('G')*S.count('R')

for i in range(N-2):
    for j in range(i,N-1):
        k = 2*j-i
        if  k<=N-1:
            if S[i]!=S[j] and S[i]!=S[k] and S[j]!=S[k] :
                cnt -= 1


print(cnt)
while True:
        a,op,b=map(input().split())
        a=int(a)
        b=int(b)
                
        if op==('+'):
                print(a+b)
        elif op==('-'):
                print(a-b)
        elif op==('*'):
                print(a*b)
        elif op==('/'):
                print(a/b)
        elif op==('?'):
                break




### FIXED CODE ###



while 1:
     s=input()
     if '?' in s: break
     print(int(eval(s)))
import math
from functools import reduce

mod = 10**9 + 7

def lcm(a, b):
	return a * b // math.gcd(a, b)


N = int(input())
A = [i for i in map(int, input().split())]

ans = reduce(lcm, A)

B = [ans//i for i in A]
print(sum(B) % mod)


### FIXED CODE ###

#from math import gcd
from fractions import gcd
from functools import reduce

mod = 10**9 + 7

def lcm(a, b):
	return a * b // gcd(a, b)


N = int(input())
A = [i for i in map(int, input().split())]

ans = reduce(lcm, A)

#print(ans)
B = [ans//i for i in A]

print(sum(B) % mod)
a,b,c,k=map(int, input().split())
ans =0
if a>=k:
	ans+=k
else:
	ans+=a
if =k-a-b>=1:
	ans+=-(k-a-b)
print(ans)


### FIXED CODE ###

a,b,c,k=map(int, input().split())
ans =0
if a>=k:
	ans+=k
else:
	ans+=a
if k-a-b>=1:
	ans+=-(k-a-b)
print(ans)
import sys

sys.setrecursionlimit(10**10)
h,w=map(int,input().split())
g=[list(input()) for _ in range(h)]
for x in range(h):
    for y in range(w):
        if g[y][x]=="#":
            k=0
            for i,j in [(1,0),(-1,0),(0,1),(0,-1)]:
                nx=x+i
                ny=y+j
                if nx<0 or nx>=h or ny<0 or ny>=w:
                   continue
                if g[ny][nx]==".":
                    k+=1
            if k==4:
                print("No")
                exit()
print("Yes")

### FIXED CODE ###

h,w=map(int,input().split())
g=[list(input()) for _ in range(h)]
for x in range(h):
    for y in range(w):
        if g[x][y]=="#":
            k=0
            for i,j in [(1,0),(-1,0),(0,1),(0,-1)]:
                nx=x+i
                ny=y+j
                if nx<0 or nx>=h or ny<0 or ny>=w:
                   continue
                if g[nx][ny]==".":
                    k+=1
            if k==4:
                print("No")
                exit()
print("Yes")
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


def main():
    n = int(input())
    color = [None]*(n-1)
    color[0] = -1

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

    def dfs(now=0, prev=-1, mycolor=-1):
        in_use = {mycolor}
        i = 0

        for tup in con[now]:
            if tup[0] != prev:
                while i < 1000:
                    if i not in in_use:
                        color[tup[1]] = i
                        in_use.add(i)
                        break
                    i += 1
                dfs(tup[0], now, i)

    dfs()

    print(max(color)+1)
    for i in color:
        print(i+1)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


def main():
    n = int(input())
    color = [None]*(n-1)
    color[0] = -1

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

    def dfs(now=0, prev=-1, mycolor=-1):
        in_use = {mycolor}
        i = 0

        for tup in con[now]:
            if tup[0] != prev:
                while True:
                    if i not in in_use:
                        color[tup[1]] = i
                        in_use.add(i)
                        break
                    i += 1
                dfs(tup[0], now, i)

    dfs()

    print(max(color)+1)
    for i in color:
        print(i+1)


if __name__ == '__main__':
    main()
import numpy as np

n = int(input())

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

y = np.zeros((n, 1), dtype=np.int)

for i, wa in enumerate(a):
    y[i][0] = wa

A = np.zeros((n, n), dtype=np.int)

exit()



### FIXED CODE ###

import numpy as np
import sys

n = int(input())

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

a_sum = sum(a)
# x[i]はi番目のダムに溜まった水の半分
x = []

x_0 = int(a_sum/2)

for i in range(int((n-1)/2)):
    x_0 -= a[2*i+1]

x.append(x_0)
x_tmp = x_0

for i in range(n-1):
    x_tmp = a[i] - x_tmp
    x.append(x_tmp)

for wa in x:
    print(wa*2, end=' ')
N, K = map(int, input().split())

X = [0] + [1] * N
for i in range(1, K+1):
    NX = [0] * (N+1)
    for j in range(1, N+1):
        NX[j] = NX[j-1] + X[N//j]
    X = NX
print(X[-1])

### FIXED CODE ###

N, K = map(int, input().split())
P = 10**9+7
R = int(N**0.5)+1
A = [i for i in range(R)] + [N//i for i in range(1, R)][::-1]
M = len(A)
X = [0] + [1] * (M-1)
for i in range(1, K+1):
    NX = [0] * M
    for j in range(1, M):
        NX[j] = (NX[j-1] + X[M-j]*(A[j]-A[j-1])) % P
    X = NX
print(X[-1])
H,N = map(int,input().split())
A = list(map(int,input().split()))
s = sum (A)
if s>=H:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

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

if H%A==0:
  print(H//A)
else:
  print(H//A+1)
n = int(input())
dp = [float("Inf")]*(n+1)
for i in range(5):
    dp[i] = i
for i in range(n):
    for j in range(1,n//6+1):
        if i + 6**j > n:
            break
        dp[i+6**j] = min(dp[i+6**j], dp[i] + 1)
    for j in range(1,n//9+1):
        if i + 9**j > n:
            break
        dp[i+9**j] = min(dp[i+9**j], dp[i] + 1)
print(dp[-1])

### FIXED CODE ###

from collections import deque
n = int(input())
q = deque([])
now = 0
reach = [0]*100001
lis = []
for i in range(6):
    lis.append(6**(i+1))
for i in range(5):
    lis.append(9**(i+1))
lis.append(1)
lis = sorted(lis)
q.append(0)
ans = 0
while q:
    if ans == 1:
        break
    x = q.popleft()
    
    for y in lis:
        if x + y < n:
            if  reach[x+y] == 0:
                q.append(x+y)
                reach[x+y] = reach[x]+1
            
        elif x + y == n:
            reach[x+y] = reach[x]+1
            ans = 1
            break
print(max(reach))
#https://atcoder.jp/contests/abc167/tasks/abc167_c C - Skill Up
import numpy as np
from itertools import combinations
N,M,X=list(map(int,input().split()))
book_dict={}
for i in range(M):
    book_dict[i] = list(map(int,input().split()))

answer = (10**5*12)+1
for i in range(M,0,-1):
    for v in combinations(book_dict.keys(), i):
        search_book = list(map(lambda x:book_dict[x],list(v)))
        sum_search_book = np.array(np.sum(search_book,axis = 0))
        if (np.count_nonzero(sum_search_book[1:] >= X) == N) and sum_search_book[0] < answer:
            answer = sum_search_book[0]
            print(ansew)
                                                                                 

    
if answer == (10**5*12)+1:
    answer = -1

print(answer)


### FIXED CODE ###

#https://atcoder.jp/contests/abc167/tasks/abc167_c C - Skill Up
import numpy as np
from itertools import combinations
N,M,X=list(map(int,input().split()))
book_dict={}
for i in range(N):
    book_dict[i] = list(map(int,input().split()))

answer = (10**5*12)+1
for i in range(N,0,-1):
    for v in combinations(book_dict.keys(), i):
        search_book = list(map(lambda x:book_dict[x],list(v)))
        sum_search_book = np.array(np.sum(search_book,axis = 0))
        if (np.count_nonzero(sum_search_book[1:] >= X) == M) and sum_search_book[0] < answer:
            answer = sum_search_book[0]
                                                                                 
    
if answer == (10**5*12)+1:
    answer = -1

print(answer)
import heapq
n,k=map(int,input().split())
can=[]
for i in range(k):
    l,r=map(int,input().split())
    for j in range(l,r+1):
        can.append(j)
table=[0]*n
table[0]=1
que=[0]
heapq.heapify(que)
can.sort()
while que:
    now=heapq.heappop(que)
    for j in can:
        if now+j>n:
            break
        table[now+j]=(table[now+j]+table[now])%998244353
        if now+j in set(que):
            continue
        heapq.heappush(que,now+j)
print(table[-1]%998244353)

### FIXED CODE ###

p=998244353
n,k=map(int,input().split())
kukan=[]
for i in range(k):
    l,r=map(int,input().split())
    kukan.append((l,r))
dp=[0]*n
sdp=[0]*(n+1)
dp[0]=1
sdp[1]=1
for i in range(1,n):
    for l,r in kukan:
        left=max(0,i-r)
        right=max(0,i-l+1)
        dp[i]=(dp[i]+sdp[right]-sdp[left])%p
    sdp[i+1]=(sdp[i]+dp[i])%p
print(dp[-1])
x=input().split()
h=int(x[0])
n=int(x[1])
import numpy as np
a=np.full(n,0,int)
b=np.full(n,0,int)
for k in range(n):
  x=input().split()
  a[k]=int(x[0])
  b[k]=int(x[1])
m=max(a)  
inf=10**8
dp=np.full(h+m+1,inf,int)
dp[0]=0
for k in range(1,h+m):
  dp[k]=(dp[np.max(k-a,-1)]+b).min()
print(dp[h:h+m].min())

  

### FIXED CODE ###

x=input().split()
H=int(x[0])
A=int(x[1])
if H%A==0:
  print(H//A)
else:
  print(H//A+1)
import sys
sys.setrecursionlimit(10**6)
import numpy as np
N, M = map(int, input().split())

MOD = 1000000007
dp = np.zeros(N, dtype = int)
if M != 0:
    A = np.array([int(input()) for _ in range(M)], dtype = int)
    dp[A - 1] = -1

if dp[0] == -1 and dp[1] == -1:
    pass
else:
    if dp[0] == -1:
        dp[1] = 1
    elif dp[1] == -1:
        dp[0] = 1
    else:
        dp[0] = 1
        dp[1] = 2


if N >= 3:
    for n in range(2, N):
        if dp[n] != -1:
            dp[n] = (max(dp[n-1], 0) + max(dp[n-2], 0)) % MOD

print (dp[-1])


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)
import numpy as np
N, M = map(int, input().split())

MOD = 1000000007
dp = np.zeros(N, dtype = int)
if M != 0:
    A = np.array([int(input()) for _ in range(M)], dtype = int)
    dp[A - 1] = -1


if dp[0] == -1 and dp[1] == -1:
    pass
else:
    if dp[0] == -1:
        dp[1] = 1
    elif N >= 2 and dp[1] == -1:
        dp[0] = 1
    elif N >= 2:
        dp[0] = 1
        dp[1] = 2
    else:
        dp[0] = 1


if N >= 3:
    for n in range(2, N):
        if dp[n] != -1:
            dp[n] = (max(dp[n-1], 0) + max(dp[n-2], 0)) % MOD

print (dp[-1])
n, h, w = map(int, input().split())
tup_list = []
for i in range(n):
    tup_list.append((map(int, input().split())))
print(tup_list)
count = 0
for tuple in tup_list:
    if tuple[0] >= h and tuple[1] >= w:
        count += 1
print(count)

### FIXED CODE ###

nhw_list = list(map(int, input().split()))
tup_list = []
for i in range(nhw_list[0]):
    tup_list.append(list(map(int, input().split())))
count = 0
for tuple in tup_list:
    if tuple[0] >= nhw_list[1] and tuple[1] >= nhw_list[2]:
        count += 1
print(count)
n = int(input())
s = input()
if len(s) <= n:
  print(s)
else:
  print(s[:k] + "...")

### FIXED CODE ###

n = int(input())
s = input()
if len(s) <= n:
  print(s)
else:
  print(s[:n] + "...")
from collections import defaultdict as dd
n, q = map(int, input().split())
Tree = dd(lambda: [])
for i in range(n-1):
    a, b = map(int, input().split())
    Tree[a].append(b)

Point = dd(lambda: 0)
for i in range(q):
    p, x = map(int, input().split())
    Point[p] += x

Ans = dd(lambda: 0)
def write(node, point):
    point += Point[node]
    Ans[node] = point
    for next_node in Tree[node]:
        write(next_node, point)
write(1, 0)

for i in range(1, n+1):
    print(Ans[i])

### FIXED CODE ###

from collections import defaultdict as dd
n, q = map(int, input().split())
Connections = dd(list)
for i in range(n-1):
    a, b = map(int, input().split())
    Connections[a].append(b)
    Connections[b].append(a)

#Tree[node] -> children(list)
Tree = dd(list)
visited = set()
stack = [1]
while stack != []:
    temp = []
    for taregt_node in stack:
        for next_node in Connections[taregt_node]:
            if next_node not in visited:
                Tree[taregt_node].append(next_node)
                visited.add(taregt_node)
                temp.append(next_node)
    stack = temp
#print(Tree)

#Point[node] -> point
Point = dd(int)
for i in range(q):
    p, x = map(int, input().split())
    Point[p] += x
#print(Point)

Counter = dd(int)
#visited = set()
stack = [1]
Counter[1] = Point[1]
while stack != []:
    temp = []
    for target_node in stack:
        for next_node in Tree[target_node]:
            Counter[next_node] = Counter[target_node] + Point[next_node]
            temp.append(next_node)
    stack = temp
#print(Counter)

for i in range(1, n):
    print(Counter[i], end=" ")
print(Counter[n])
N,M = map(int,input().split())
tmp = N*(N-1)//2
l = []
cnt = []
ab = [list(map(int, input().split())) for i in range(M)]
# print(ans)
herasu = 0
ans = [tmp]
for i in ab[::-1]:
    
    if (i[0] in cnt) and (i[1] in cnt):
#         print("両方ある")
        for index, l1 in enumerate(l):
            if i[0] in l1:
                tmp0 = index
            if i[1] in l1:
                tmp1 = index
        herasu += len(l[tmp0])*len(l[tmp1])
        del(l[tmp0])
        del(l[tmp1])
        l.append(l[tmp0]+l[tmp1])
        
        
    if (i[0] not in cnt) and (i[1] not in cnt):
#         print("両方ない")
        cnt += [i[0],i[1]]
        l.append(i)
        herasu += 1
        
    else:
#         print("片方しか入ってない")
        for l1 in l:
#             print(l1)
            if i[0] in l1:
#                 print(i[0], "がl1にあった")
                herasu += len(l1)
                l1.append(i[1])
                break
            if i[1] in l1:
                
                herasu += len(l1)
                l1.append(i[0])
                break
    
    ans.append(tmp-herasu)
    
for i in ans[::-1][1:]:
    print(i)


### FIXED CODE ###

class UnionFind:
    def __init__(self,size):
        self.par = [i for i in range(size)]
        self.rank = [0 for _ in range(size)]
        self.size = [1 for _ in range(size)]
        
    # xの根を返す
    def find(self,x):
        if self.par[x] == x:
            return x
        else:
            return self.find(self.par[x])
            
    # xとyを同じグループに
    def union(self,x,y):
        x = self.find(x)
        y = self.find(y)
        if self.rank[x] > self.rank[y]:
            self.par[y] = x
            self.size[x] += self.size[y]
        else:
            self.par[x] = y
            self.size[y] += self.size[x]
            if self.rank[x] == self.rank[y]:
                self.rank[y] += 1
        
    # xとyが同じグループか判定
    def same(self,x,y):
        return self.find(x) == self.find(y)
    
N,M = map(int,input().split())
s = N*(N-1)//2
ans = []
ab = [list(map(lambda x: int(x) - 1, input().split())) for i in range(M)]

tree = UnionFind(N)

for index, bridge in enumerate(ab[::-1]):
    if tree.same(bridge[0],bridge[1]):
        ans.append(s)
    else:
        d = tree.size[tree.find(bridge[0])] * tree.size[tree.find(bridge[1])]
        tree.union(bridge[0],bridge[1])
        ans.append(s)
        s -= d
        
print("\n".join(map(str, ans[::-1])))
n,m = map(int,input().split())
dp = [float('inf')]*(1<<n)
dp[0] = 0
for _ in range(m):
    a,b = map(int,input().split())
    sc = 0
    for e in map(int,input().split()):
        bit += 1<<(e-1)
    for i in range(1<<n):
        dp[i|bit] = min(dp[i|bit], dp[i]+a)
if dp[-1] == float('inf'):
    print(-1)
else:
    print(dp[-1])

### FIXED CODE ###

n,m = map(int,input().split())
dp = [float('inf')]*(1<<n)
dp[0] = 0
for _ in range(m):
    a,b = map(int,input().split())
    bit = 0
    for e in map(int,input().split()):
        bit += 1<<(e-1)
    for i in range(1<<n):
        dp[i|bit] = min(dp[i|bit], dp[i]+a)
if dp[-1] == float('inf'):
    print(-1)
else:
    print(dp[-1])
n = int(input())
h = list(map(int, input().split()))
h.reverse()
l =[]
for i in range(n-1):
    count=0
    while h[i] <= h[i+1]:
        count+=1
        if i+1 ==n-1:
            break
        i+=1
    l.append(count)
print(max(l))

### FIXED CODE ###

n = int(input())
h = list(map(int, input().split()))
l = 0
j = 0
while j < n-1:
    count = 0
    i = j
    while h[i] >= h[i+1]:
        count+=1
        if i+1 == n-1:
            break
        i+=1
    if l < count:
        l =count
    j += count+1

print(l)
N, M = map(int, input().split())
SC = [[] for _ in range(N)]

error = False
for _ in range(M):
    s, c = map(int, input().split())
    s -= 1
    if SC[s] and SC[s] != c:
        error = True
        break
    else:
        SC[s] = c

if error:
    print(-1)
elif SC[0] == 0 and len(SC) > 1:
    print(-1)
else:
    if not SC[0]:
        SC[0] = 1
    if not SC[1]:
        SC[1] = 0
    if not SC[2]:
        SC[2] = 0
    print(''.join(map(str,SC)))

### FIXED CODE ###

N, M = map(int, input().split())
A = [float('inf') for _ in range(N)]

for i in range(M):
    s, c = map(int, input().split())
    s -= 1
    
    if A[s] != float('inf') and A[s] != c:
        print(-1)
        exit()

    A[s] = min(A[s], c)
    #A[s] = c

for i in range(1, N):
    if A[i] == float('inf'):
        A[i] = '0'
    A[i] = str(A[i]) 

#print(A)

if A[0] == float('inf'):
    if len(A) == 1: A[0] = '0'
    else: A[0] = '1'
else:
    A[0] = str(A[0])

ans = int(''.join(A))

if len(str(ans)) == N: print(ans)
else: print(-1)
while True:
    n = int(raw_input())
    if n == 0:
        break
    magic = [[0 for i in range(n)] for i in range(n)]
    x, y = n/2, n/2
    magic[y][x] = 1
    count = 2
    while count <= n**2:
        x, y = (x+1)%n, (y+1)%n
        if magic[y][x] == 0:
            magic[y][x] = count
            count += 1
        else:
            x, y = (x-1)%n, (y+1)%n
            magic[y][x] = count
            count += 1
    for i in xrange(n):
        print "".join(map(lambda s:str(s).rjust(4),board[i])

### FIXED CODE ###

while True:
    n = int(raw_input())
    if n == 0:
        break
    magic = [[0 for i in range(n)] for i in range(n)]
    x, y = n/2, n/2+1
    magic[y][x] = 1
    count = 2
    while count <= n**2:
        x, y = (x+1)%n, (y+1)%n
        if magic[y][x] == 0:
            magic[y][x] = count
            count += 1
        else:
            x, y = (x-1)%n, (y+1)%n
            magic[y][x] = count
            count += 1
    for i in xrange(n):
        print "".join(map(lambda s:str(s).rjust(4),magic[i]))
x,y = map(int,input().split())
while x <= y:
    ans += 1
    x *= 2
print(ans)

### FIXED CODE ###

x,y = map(int,input().split())
ans = 0
while x <= y:
    ans += 1
    x *= 2
print(ans)
s = list(input())

ans = 'AC'
if s[0] != 'A':
    ans = 'WA'  

if s[2:-1].count('C') != 1:
    ans = 'WA'

s.remove('A')
s.remove('C')
if "".join(s).isupper():
    ans = 'WA'

print(ans)

### FIXED CODE ###

s = list(input())

ans = 'AC'
if s[0] != 'A':
    ans = 'WA'  

if s[2:-1].count('C') != 1:
    ans = 'WA'

cnt = 0
for i in s:
    
    if 'A' <= i <= 'Z':
        cnt += 1

if cnt != 2:
    ans = 'WA'

print(ans)
n = int(input())
x = [int(i) for i in input().split()]
ans = 100100100
for i in range(1,101) :
    s = 0
    for o in x :
        s+=(i-x)*(i-x)
    ans = min(ans,s)
print(ans)

### FIXED CODE ###

n = int(input())
x = [int(i) for i in input().split()]
ans = 100100100
for i in range(1,101) :
    s = 0
    for o in x :
        s+=(i-o)*(i-o)
    ans = min(ans,s)
print(ans)