Harryxun/stf_run huggingface dataset:
nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

N, A = nl()
X = nl()

dp = []
for i in range(N+1):
    r = []
    for j in range(N+1):
        r.append([0 for k in range(N*max(X)+1)])
    dp.append(r)

dp[0][0][0] = 1
for i in range(1, N+1):
    for j in range(0, N+1):
        for k in range(N*max(X)+1):
            if k < X[i-1]:
                dp[i][j][k] = dp[i-1][j][k]
            elif j > 0:
                dp[i][j][k] = dp[i-1][j][k] + dp[i-1][j-1][k-X[i-1]]

total = 0
for k in range(1, N+1):
    total += dp[N][k][k*A]
print(total)




### FIXED CODE ###

nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

N, A = nl()
X = nl()

dp = []
for i in range(N+1):
    r = []
    for j in range(N+1):
        r.append([0 for k in range(N*50+1)])
    dp.append(r)

dp[0][0][0] = 1
for i in range(1, N+1):
    for j in range(0, N+1):
        for k in range(N*50+1):
            if k < X[i-1]:
                dp[i][j][k] = dp[i-1][j][k]
            elif j > 0 and k >= X[i-1]:
                dp[i][j][k] = dp[i-1][j][k] + dp[i-1][j-1][k-X[i-1]]

total = 0
for k in range(1, N+1):
    total += dp[N][k][k*A]
print(total)
n=int(input())
A=list(map(int,input().split()))

for i in range(1,n):
	print(" ".join(map(int,A)))
	j=i-1
	while A[j]<A[j-1] and j>0:
		(A[j],A[j-1])=(A[j-1],A[j])
		j=j-1
else:
	print(" ".join(map(int,A)))

### FIXED CODE ###

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

for i in range(1,n):
	print(" ".join(map(str,A)))
	j=i
	while A[j]<A[j-1] and j>0:
		(A[j],A[j-1])=(A[j-1],A[j])
		j=j-1
else:
	print(" ".join(map(str,A)))
def xor(n1, n2):
  if n2=="0":
    return n1
  elif n2=="1":
    if n1=="1":
      return "0"
    else:
      return "1"
      
def bitxor(n1, n2):

  bn1 = bin(n1)[2:]
  bn2 = bin(n2)[2:]
  if n1<n2:
    bn1 = bn1.zfill(len(bn2))
  else:
    bn2 = bn2.zfill(len(bn1))
    
  n3 = [xor(b1,b2) for b1,b2 in zip(bn1, bn2)]
  n3 = "".join(n3)
  return int(n3, 2)


n = int(input())
a = [int(x) for x in input().split()]
a_unique = list(set(a))
l = len(a)

u0 = a.count(a_unique[0])
u1 = a.count(a_unique[1])
u2 = a.count(a_unique[2])

if l%3==0 and (a_unique[2]== bitxor(a_unique[0], a_unique[1])) and (u0==u1 and u1==u2):
  print("Yes")
else:
  print("No")


### FIXED CODE ###

def xor(n1, n2):
  if n2=="0":
    return n1
  elif n2=="1":
    if n1=="1":
      return "0"
    else:
      return "1"
      
def bitxor(n1, n2):
 
  bn1 = bin(n1)[2:]
  bn2 = bin(n2)[2:]
  if n1<n2:
    bn1 = bn1.zfill(len(bn2))
  else:
    bn2 = bn2.zfill(len(bn1))
    
  n3 = [xor(b1,b2) for b1,b2 in zip(bn1, bn2)]
  n3 = "".join(n3)
  return int(n3, 2)
 
 
n = int(input())
a = [int(x) for x in input().split()]
a_unique = list(set(a))
la = len(a)
lau = len(a_unique)

if a_unique==[0]:
  print("Yes")

elif la%3==0 and (0 in a_unique):
  u0 = a.count(0)
  if u0*3!=la:
    print("No")
  else:
    a_unique.remove(0)
    tmp = [(a.count(ai)%2==0) for ai in a_unique]
    if len(tmp)==sum(tmp):
      print("Yes")
    else:
      print("No")

elif la%3==0 and lau==2 and (0 in a_unique):
  u0 = a.count(0)
  if a_unique[0]==0:
    num = a_unique[1]
  else:
    num = a_unique[0]
  u1 = a.count(num)
  if u0*2==u1:
    print("Yes")
elif la%3!=0 or lau!=3:
  print("No")
else:
  u0 = a.count(a_unique[0])
  u1 = a.count(a_unique[1])
  u2 = a.count(a_unique[2])
 
  if (a_unique[2]== bitxor(a_unique[0], a_unique[1])) and (u0==u1 and u1==u2):
    print("Yes")
  else:
    print("No")
dishes = [int(input()) for _ in range(5)]

dishes = sorted(dishes, key=lambda x: 10 - int(str(x)[-1]))
a = list()
b = list()
for d in dishes:
    if d % 10 == 0:
        a.append(d)
    else:
        b.append(d)
b = [dish + 10 - dish % 10 for dish in b[:-1]] + [b[-1]]
dishes = a + b
print(sum(dishes))


### FIXED CODE ###

dishes = [int(input()) for _ in range(5)]

dishes = sorted(dishes, key=lambda x: 10 - int(str(x)[-1]))
a = list()
b = list()
for d in dishes:
    if d % 10 == 0:
        a.append(d)
    else:
        b.append(d)
if len(b) > 0:
    b = [d + 10 - d % 10 for d in b[:-1]] + [b[-1]]
dishes = a + b
print(sum(dishes))
Number = input()
 
tresure_value = list(map(int , input().split()))
 
cost = list(map(int , input().split()))
 
count = 0
 
for i in range(Number):
  benefit = int(tresure_value[i] - cost[i])
  if benefit  > 0:
    count += benefit 
    
print(count)

### FIXED CODE ###

Number = int(input())
tresure_value = list(map(int , input().split()))
cost = list(map(int , input().split()))
cnt = 0
 
for i in range(len(tresure_value)):
  benefit = tresure_value[i] - cost[i]
  if benefit  > 0:
    cnt = cnt + benefit 
    
print(cnt)
n = int(raw_input())
ans = []
for i in range(n):
	marks = map(float, raw_input().split())
	AB = (marks[1] - marks[3]) / (marks[0] - marks[2])
	CD = (marks[5] - marks[7]) / (marks[4] - marks[6])
	if AB == CD:
		ans.append('YES')
	else:
		ans.append('NO')
for s in ans:
	print s

### FIXED CODE ###

for i in range(int(input())):
    x1, y1, x2, y2, x3, y3, x4, y4 = map(float, input().split())
    if abs((y1 - y2) * (x3 - x4) - (y3 - y4) * (x1 - x2)) < 1.e-10:
        print('YES')
    else:
        print('NO')
while True:
    a=input()
    if '?' in a:break
    if '/' in a:/=//
    eval(a)

### FIXED CODE ###

while True:
    a=input()
    if '?' in a:break
    print(int(eval(a)))
S = input()
print(S.replace("018"), ("017"))

### FIXED CODE ###

S = input()
print(S.replace('2017','2018'))
N = int(input())
A = [map(int, input().split())]
count = 0
while True:
    for i in range(N):
        if A[i] % 2 == 0:
            A[i] = A[i] // 2
        else:
            break
            
    else:
        count += 1
        continue
        
    break

print(count)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
count = 0
while True:
    for i in range(N):
        if A[i] % 2 == 0:
            A[i] = A[i] // 2
        else:
            break
            
    else:
        count += 1
        continue
        
    break
    
print(count)
N, M = map(int, input().split())
A = [input().split() for i in range(M)]

w = sum(A)

r = N-w

if r<0:
  print(-1)
else:
  print(r)

### FIXED CODE ###

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

w = sum(A)

r = N-w

if r<0:
  print(-1)
else:
  print(r)
c = input()
print(shr(ord(c)+1))

### FIXED CODE ###

c = input()
print(chr(ord(c)+1))
n=int(input())
for count in range(10):
    if 100*count+10*count+count>n-1:
        input(100*count+10*count+count)
        break
    else:
        pass

### FIXED CODE ###

n=int(input())
for count in range(10):
    if 100*count+10*count+count>n-1:
        print(100*count+10*count+count)
        break
    else:
        pass
from collections import defaultdict
from operator import sub

def main():
    N = int(input())
    balls = [tuple(map(int,input().split())) for _ in range(N)]
    d = defaultdict(int)
    for i in range(N):
        for j in range(N):
            if i == j:
                continue
            d[tuple(map(sub, balls[i], balls[j]))] += 1
    try:
        mmax = max(d.values())
        mmax = N - mmax
    except:
        print(100)
    print(mmax)


if __name__ == '__main__':
    main()

### FIXED CODE ###

from collections import defaultdict
from operator import sub

def main():
    N = int(input())
    balls = [tuple(map(int,input().split())) for _ in range(N)]
    d = defaultdict(int)
    for i in range(N):
        for j in range(N):
            if i == j:
                continue
            d[tuple(map(sub, balls[i], balls[j]))] += 1
    try:
        mmax = N - max(d.values(), default=0)
        print(mmax)
    except ValueError:
        print(100)

if __name__ == '__main__':
    main()
a,b,c,d,e,f = map(int, input().split())
ans = 0
for i in range(f//(a*100)+1):
  for j in range((f-a*100*i)//(b*100)+1):
    for k in range((f-a*i*100-b*j*100)//c+1):
      for l in range((f-a*i*100-b*j*100-c*k)//d+1):
        w = i+j
        s = k+l
        if w*e >= k:
          ans = max(ans,s/(w*100+s))
print(ans)

### FIXED CODE ###

a,b,c,d,e,f = map(int, input().split())
ans = [-1,0,0]
for i in range(f//(a*100)+1):
  for j in range((f-a*100*i)//(b*100)+1):
    for k in range((f-a*i*100-b*j*100)//c+1):
      for l in range((f-a*i*100-b*j*100-c*k)//d+1):
        w = i*a+j*b
        s = k*c+l*d
        if w == 0:
          continue
        if w*e >= s and ans[0] < s/(w*100+s):
          ans = [s/(w*100+s),w*100+s,s]
print(ans[1],ans[2])
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N,S = read().decode('utf-8').split()
print(N,S)
count = 0
for i in range(1000):
  s = str(i).zfill(3)
  index_all = 0
  for j in range(3):
    index = S[index_all:].find(s[j])
    if index == -1:
      break
    index_all += index+1
    if j ==2:
      count += 1
print(count)import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N,S = read().decode('utf-8').split()
count = 0
for i in range(1000):
  s = str(i).zfill(3)
  index_all = 0
  for j in range(3):
    index = S[index_all:].find(s[j])
    if index == -1:
      break
    index_all += index+1
    if j ==2:
      count += 1
print(count)

### FIXED CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N,S = read().decode('utf-8').split()
count = 0
for i in range(1000):
  s = str(i).zfill(3)
  index_all = 0
  for j in range(3):
    index = S[index_all:].find(s[j])
    if index == -1:
      break
    index_all += index+1
    if j ==2:
      count += 1
print(count)
3
3 1 2

### FIXED CODE ###

N=int(input())
d=list(map(int,input().split()))
HP=0
for i in range(N):
    for j in range(i+1,N):
        HP+=d[i]*d[j]
print(HP)
class int(int):  
  def times(self, callback):
    for times in range(0,self):
      callback()

class list(list):
  def maps(self, callback):
    return list(map(callback, self))

  def each(self, callback):
    list(map(callback, self))
    return self

  # index will sent to the function as a second parameter.
  def each_with_index(self,callback):
    list(map(callback, self, range(0,len(self))))
    return self

# Make sure you initialize object with class name.
# Ex: int(10).times, array = list([1,2,3,4,5])

target, length = input().split()
target = int(target)
length = int(length)

if length > 0:
  o_nums = list(input().split())

  def convert(arg):
    return int(arg)

  o_nums = o_nums.maps(convert)
  diffs = list()
  nums = list()
  for exclude_num in range(min(o_nums), max(o_nums)+1):
    if exclude_num in o_nums:
      continue
    else:
      nums.append(exclude_num)

  for num in nums:
    diffs.append(target - num)

  def absm(arg):
    return abs(arg)

  diffs_abs = diffs.maps(absm)
  smallest_diff_index = diffs_abs.index(min(diffs_abs)) #絶対値が最も小さいもの

  if -(diffs_abs[smallest_diff_index]) in diffs: # ターゲットよりも小さい、最も差分が小さい値を探す
    index = diffs.index(-(diffs_abs[smallest_diff_index]))
    print(nums[index])
  else:
    print(nums[smallest_diff_index])

else:
  print(target)







### FIXED CODE ###

class int(int):  
  def times(self, callback):
    for times in range(0,self):
      callback()

class list(list):
  def maps(self, callback):
    return list(map(callback, self))

  def each(self, callback):
    list(map(callback, self))
    return self

  # index will sent to the function as a second parameter.
  def each_with_index(self,callback):
    list(map(callback, self, range(0,len(self))))
    return self

# Make sure you initialize object with class name.
# Ex: int(10).times, array = list([1,2,3,4,5])

target, length = input().split()
target = int(target)
length = int(length)
nums = list(input().split())

def convert(arg):
    return int(arg)
nums = nums.maps(convert)

for i in range(0,101):
  a = target - i
  if a not in nums:
    print(a)
    exit()

  b = target + i
  if b not in nums:
    print(b)
    exit()
n=int(input())
p=[list(map(int,input().split()))]
if n==1:
  print(p[0][0],p[0][1],p[0][2])
else:
  for i in range(0,101):
    for j in range(0,101):
      k=1
      l=p[0][2]+abs(i-p[0][1])+abs(j-p[0][1])
      for x,y,h in p:
        m=h+abs(i-x)+abs(j-y)
        if l!=m:
          k=0
      if k:
        ans=[i,j,l]
  print(ans[0],ans[1],ans[2])

### FIXED CODE ###

n=int(input())
p=[list(map(int,input().split()))for i in range(n)]
d=[]
for i in range(n):
  if p[i][2]==0:
    d.append(i)
d.sort(reverse=1)
for i in d:
  del p[i]
if len(p)==1:
  print(p[0][0],p[0][1],p[0][2])
else:
  for i in range(0,101):
    for j in range(0,101):
      k=1
      l=p[0][2]+abs(i-p[0][0])+abs(j-p[0][1])
      for x,y,h in p:
        if h==0:
          continue
        m=h+abs(i-x)+abs(j-y)
        if l!=m:
          k=0
      if k:
        ans=[i,j,l]
  print(ans[0],ans[1],ans[2])
# coding:utf-8
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))
import sys
input = sys.stdin.readline

def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    B = [1]
    a = 1
    check = [0] * len(A)
    while True:
        a = A[a - 1]
        if check[a - 1] == 1:
            x = B.index(a)
            roop = B[x:]
            print(roop[(K - x) % len(roop)])
            exit()
        B.append(a)
        check[a - 1] += 1
    if len(B) >= K + 1:
        print(B[K])
if __name__ == '__main__':
    main()

### FIXED CODE ###

S = input()
T = input()
U = T[0:len(S)]
if U == S:
    print('Yes')
else:
    print('No')
import sys
import numpy as np
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

MOD = 10 ** 9 + 7
N = int(input())
A = [[int(x) for x in input().split()] for _ in range(N)]

bit_to_i = {1<<i:i for i in range(N)}

dp = [0] * (1<<N)
dp[0] = 1

for n in range(1,1<<N):
    bits = []
    m = n
    while n:
        x = n & (-n)
        bits.append(x)
        n -= x
    n = m
    k = len(bits)
    dp[n] = sum(dp[n-x] for x in bits if A[k-1][bit_to_i[x]]) % MOD

answer = dp[-1]
print(answer)

### FIXED CODE ###

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

MOD = 10 ** 9 + 7
N = int(input())
A = [[int(x) for x in input().split()] for _ in range(N)]

bit_count = [0]
for _ in range(N):
    bit_count += [x+1 for x in bit_count]
    
dp = [0] * (1<<N)
dp[0] = 1

for i in range((1<<N)-1):
    k = bit_count[i]
    for c in range(N):
        if A[k][c]:
            dp[(1<<c)^i] += dp[i]

answer = dp[-1] % MOD
print(answer)
import math
for i in range(int(input(n))):
    n = math.ceil((n*1.05)/1000)*1000

### FIXED CODE ###

import math as m
yen = 100000
for i in range(int(input())):
    yen = m.ceil((yen*1.05)/1000)*1000
print(yen)
import math
print(~-float(input())*2*math.pi)

### FIXED CODE ###

print(int(input())*6.28)
N, M map(int, input().split())
print("Yes" if N==M else "No")

### FIXED CODE ###

N, M = map(int, input().split())
print("Yes" if N == M else "No")
n= int(input())
lst = [int(i) for i in input().split()]
lst = sorted(lst)
count = 0
d_lst = []
for i in range(len(lst)):
    if lst[i] not in d_lst:
        if lst[i] == lst[i+1]:
            d_lst.append(lst[i])
for d in d_lst:
    count += d**2
lst = set(lst)

for i in range(len(lst)):
    for j in range(i+1,len(lst)):
        a = lst[i] * lst[j]
        count += a

if count > ( 10**9 + 7 ):
    print(count % (10**9 + 7))
else:
    print(count)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
ruiseki = 0
count = 0
for i in range(n-1):
    ruiseki += a[i]
    count += ruiseki * a[i+1]
mod = 10**9 + 7
if count >= mod:
    print(count%mod)
else:
    print(count)
s=list(input())
x=len(s)

for i i range(1,x//2):
    s=s[:-2]
    if s[:len(s)//2==s[len(s)//2:]:
            break
print(len(s))


### FIXED CODE ###

s=list(str(input())
        )
for i in range(1,len(s)//2):
    s=s[:-2]
    if s[:len(s)//2]==s[len(s)//2:]:
        break
print(len(s))
import math

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

a -= 1

lcm = c * d // math.gcd(c, d)

b_sum = b - (b // c) - (b // d) + (b // lcm)
a_sum = a - (a // c) - (a // d) + (a // lcm)

print(b_sum - a_sum)

### FIXED CODE ###

import fractions

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

a -= 1

lcm = c * d // fractions.gcd(c, d)

b_sum = b - (b // c) - (b // d) + (b // lcm)
a_sum = a - (a // c) - (a // d) + (a // lcm)

print(b_sum - a_sum)
n,k=map(int,input().split())

ans = 0

for i in range(1,n-1):
  p = i
  r = 1
  while < k:
    p*=2
    r/=2
  ans+=r

ans/=n

print(ans)

### FIXED CODE ###

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

ans = 0

for i in range(1,n+1):
  p = i
  r = 1
  while p < k:
    p*=2
    r/=2
  ans+=r

ans/=n

print(ans)
a = input()
b = input()
t = int(a.split(" ")[0])
lst = [int(x) for x in b.split(" ")]
x = len(lst)
if not x:
    print(t)
for i in range(x):
    if t - i not in lst:
        print(t - i)
        break
    if t + i not in lst:
        print(t + i)
        break


### FIXED CODE ###

a = input()

t, c = int(a.split(" ")[0]), int(a.split(" ")[1])

if not c:
    print(t)
else:
    b = input()
    lst = [int(x) for x in b.split(" ")]

    for i in range(c+2):
        if t - i not in lst:
            print(t - i)
            break
        if t + i not in lst:
            print(t + i)
            break
from collections import deque
from bisect import bisect_right
from copy import deepcopy
n=int(input())
a=list(map(int,input().split()))
edge=[[] for _ in range(n)]
for _ in range(n-1):
    u,v=map(int,input().split())
    u-=1
    v-=1
    edge[u].append(v)
    edge[v].append(u)
visited=[True]*n
lis=[[] for _ in range(n)]
def dfs():
    stack=deque([0])
    visited[0]=False
    lis[0]=[a[0]]
    while stack:
        x=stack.pop()
        for nx in edge[x]:
            if visited[nx]:
                if a[nx]>lis[x][-1]:
                    lis[nx]=lis[x]+[a[nx]]
                else:
                    idx=bisect_right(cur,a[nx])
                    cur=deepcopy(lis[x])
                    cur[idx]=a[nx]
                    lis[nx]=cur
                visited[nx]=False
                stack.append(nx)
    return
dfs()
for i in range(n):
    print(len(lis[i]))

### FIXED CODE ###

from collections import deque
from bisect import bisect_left
import sys
sys.setrecursionlimit(10**7)
n=int(input())
a=list(map(int,input().split()))
edge=[[] for _ in range(n)]
for _ in range(n-1):
    u,v=map(int,input().split())
    u-=1
    v-=1
    edge[u].append(v)
    edge[v].append(u)
stack=deque([])
inf=10**18
lis=[inf]*(n+1)
ans=[0 for _ in range(n)]
visited=[True]*n
#print(edge)
def dfs(s):
    visited[s]=False
    idx=bisect_left(lis,a[s])
    stack.append((idx,lis[idx]))
    lis[idx]=a[s]
    ans[s]=bisect_left(lis,inf)
    for x in edge[s]:
        if visited[x]:
            dfs(x)
    idx,val=stack.pop()
    lis[idx]=val
dfs(0)
#print(lis)
for i in range(n):
    print(ans[i])
n = int(input())
if n[::-1]==n:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

n = input()
if n[::-1]==n:
    print("Yes")
else:
    print("No")
n = int(input())
list = [int(x) for x in input().split(" ")]
result = 'APPROVED'
for i in range(len(list)):
    if list[i]%2 == 0:
        if list[i]%3!=0 AND list[i]%5!=0:
            result = 'DENIED'
            break
print(result)

### FIXED CODE ###

n = int(input())
list = [int(x) for x in input().split(" ")]
result = 'APPROVED'
for i in range(len(list)):
    if list[i]%2 == 0:
        if list[i]%3 != 0 and list[i]%5 != 0:
            result = 'DENIED'
            break
print(result)
def koch(n, a, b):
  if n == 0:
    return
  s.x = (2*a[0]* + b[0])/3
  s.y = (2*a[1]* + b[1])/3
  t.x = (a[0]* + 2*b.x)/3
  t.y = (a[1]* + 2*b.y)/3
  u.x = (t.x - s.x)*cos(pi/3) - (t.y - s.y)*sin(pi/3) + s.x
  u.y = (t.x - s.x)*sin(pi/3) + (t.y - s.y)*cos(pi/3) + s.y

  koch(n-1, a, s)
  print  s.x, s.y
  koch(n-1, s, u)
  print  u.x, u.y
  koch(n-1, u, t)
  print  t.x, t.y
  koch(n-1, t, b)

n = input()

p1.x = 0
p1.y = 0
p2.x = 100
p2.y = 0

print p1.x, p2.y
koch(n, p1, p2)
print p1.x, p2.y

### FIXED CODE ###

import math

rad = math.radians(60)

class coordinates:
  def __init__(self, x, y):
    self.x = x
    self.y = y
 
def koch(n, a, b):
  if n == 0:
    return
  s = coordinates((2.0*a.x + b.x)/3.0, (2.0*a.y + b.y)/3.0)
  t = coordinates((a.x + 2.0*b.x)/3.0, (a.y + 2.0*b.y)/3.0)
  ux = (t.x - s.x)*math.cos(rad) - (t.y - s.y)*math.sin(rad) + s.x
  uy = (t.x - s.x)*math.sin(rad) + (t.y - s.y)*math.cos(rad) + s.y
  u = coordinates(ux, uy)
  
  koch(n-1, a, s)
  print  s.x, s.y
  koch(n-1, s, u)
  print  u.x, u.y
  koch(n-1, u, t)
  print  t.x, t.y
  koch(n-1, t, b)
  
n = input()
  
p1 = coordinates(0.0, 0.0)
p2 = coordinates(100.0, 0.0)
  
print p1.x, p1.y
koch(n, p1, p2)
print p2.x, p2.y
import sys
N = int(input())
A = list(map(int, input().split()))

if A[:1] < A[1:]:
  print(abs(A[1:]-A[:1]))
  sys.exit()
if A[:1] > A[1:]:
  print(abs(A[:1]-A[1:]))
  sys.exit()

sep = N//2
for i in range(N):
  if sum(A[:sep]) >= sum(A[sep:]):
    sep -= N//((i+2)**2)
  else:
    sep += N//((i+2)**2)
  if N//((i+2)**2) == 1:
    break
#print(sep)


a = abs(sum(A[:sep])-sum(A[sep:]))
b = abs(sum(A[:sep+1])-sum(A[sep+1:]))
c = abs(sum(A[:sep-1])-sum(A[sep-1:]))
print(min(a,b,c,d,e))

### FIXED CODE ###

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

sep = N//2
for i in range(N):
  if sum(A[:sep]) >= sum(A[sep:]):
    sep -= N//((i+2)**2)
  else:
    sep += N//((i+2)**2)
  if N//((i+2)**2) == 1:
    break
#print(sep)


a = abs(sum(A[:sep])-sum(A[sep:]))
b = abs(sum(A[:sep+1])-sum(A[sep+1:]))
c = abs(sum(A[:sep-1])-sum(A[sep-1:]))
d = abs(sum(A[:sep+2])-sum(A[sep+2:]))
e = abs(sum(A[:sep-2])-sum(A[sep-2:]))
print(min(a,b,c,d,e))
i = 0
while x=int(input()):
 i = i + 1
 print("Case {i}:{x}", i, x)

### FIXED CODE ###

i=0
x=int(input())
while x != 0:
 i = i+1
 print("Case " + str(i) + ": " + str(x))
 x=int(input())
h, n = [int(i) for i in input().split()]

magics = [None]


class Magic:
    def __init__(self, attack, cost):
        self.attack = attack
        self.cost = cost


maxA = 0
for i in range(n):
    attack, cost = [int(i) for i in input().split()]
    maxA = max(maxA, attack)
    magics.append(Magic(attack, cost))

dp = [[10 ** 9 for i in range(h + 1)] for j in range(n + 1)]

for i in range(n + 1):
    for j in range(h + 1):
        if j == 0:
            dp[i][j] = 0
        elif i == 0:
            continue
        elif j - magics[i].attack >= 0:
            dp[i][j] = min(dp[i - 1][j], dp[i][j - magics[i].attack] + magics[i].cost)

print(min(dp[-1][-1]))

### FIXED CODE ###

h, n = [int(i) for i in input().split()]

magics = [None]


class Magic:
    def __init__(self, attack, cost):
        self.attack = attack
        self.cost = cost


maxA = 0
for i in range(n):
    attack, cost = [int(i) for i in input().split()]
    maxA = max(maxA, attack)
    magics.append(Magic(attack, cost))

dp = [[10 ** 9 for i in range(h + maxA)] for j in range(n + 1)]

for i in range(n + 1):
    for j in range(h + maxA):
        if j == 0:
            dp[i][j] = 0
        elif i == 0:
            continue
        elif j - magics[i].attack >= 0:
            dp[i][j] = min(dp[i - 1][j], dp[i][j - magics[i].attack] + magics[i].cost)
        else:
            dp[i][j] = dp[i - 1][j]

print(min(dp[-1][h:]))
#!/usr/bin/python

import sys

pi =3.141592653589

r = int(raw_input())

area = r * r * pi
length = 2 * r * pi

print str(area) + " " + str(length) + "\n"

sys.exit()

### FIXED CODE ###

import math
n = input()
S = '%.6f' % (float(n)**2 * math.pi)
L = '%.6f' % (float(n) * 2 * math.pi)
print "{} {}".format(S,L)
N = int(input())
Tlist = [int(N) for N in input().split()]
M = int(input())
PXlist = [[int(i) for i in input().split()]for j in range(M)]
def time_sum():
    s = 0
    for i in range(0,N):
        s = s+Tlist[i]
    return s
def time_cal():
    empty = []
    for i in range(0,M):
        empty.append(time_sum() - Tlist[PXlist[i][0]-1] + PXlist[i][1])
    return empty
for i in time_cal():
    print(i)

### FIXED CODE ###

A, op, B = input().split()
if op is '+':
  print(int(A)+int(B))
if op is '-':
  print(int(A)-int(B))