Harryxun/stf_run huggingface dataset:
# coding: UTF-8
from collections import deque

dll = deque()

n = int(input())
for _ in range(n):
  raw = input().split()
  command = raw[0]
  if command == 'delete': 
    value = raw[1]
    dll.remove(value)
  elif command == 'insert':
    value = raw[1]
    dll.appendleft(value)
  elif command == 'deleteFirst':
    dll.popleft()
  else:
    dll.pop()

print(" ".join(dll))


### FIXED CODE ###

# coding: UTF-8
from collections import deque

dll = deque()

n = int(input())
for _ in range(n):
  raw = input().split()
  command = raw[0]
  if command == 'delete': 
    value = raw[1]
    try:
      dll.remove(value)
    except ValueError as err:
      continue
  elif command == 'insert':
    value = raw[1]
    dll.appendleft(value)
  elif command == 'deleteFirst':
    try:
      dll.popleft()
    except IndexError as err:
      continue
  elif command == 'deleteLast':
    try:
      dll.pop()
    except IndexError as err:
      continue

print(" ".join(dll))
n = int(input())
s = input()

if n % 2 == 1:
  print('No')
else:
  s1 = s[: n/2]
  s2 = s[n/2: ]
  
  if s1 == s2:
    print('Yes')
  else:
    print('No')


### FIXED CODE ###

n = int(input())
s = input()

if n % 2 == 1:
  print('No')
else:
  m = int(n/2)
  s1 = s[: m]
  s2 = s[m: ]
  
  if s1 == s2:
    print('Yes')
  else:
    print('No')
def solve():
    N,M = map(int, input().split())
    A = [input() for _ in range(N)]
    B = [input() for _ in range(M)]
    idx = 0
    start_pos = {}
    for S_a in A:
        indices = set(find_indices(S_a, B[idx], N))
        if not start_pos:
            start_pos = indices
        else:
            start_pos &= indices
        
        if start_pos:
            idx += 1
        else:
            start_pos = {}
            idx = 0
            
        if idx == M:
            break
    
    print('Yes' if start_pos else 'No')
    
solve()

### FIXED CODE ###

def find_indices(a, b, L):
    # aからbのパターンをみつける
    return [i for i in range(L) if a[i:].startswith(b)]

def solve():
    N,M = map(int, input().split())
    A = [input() for _ in range(N)]
    B = [input() for _ in range(M)]
    idx = 0
    start_pos = {}
    for S_a in A:
        indices = set(find_indices(S_a, B[idx], N))
        if not start_pos:
            start_pos = indices
        else:
            start_pos = start_pos&indices
        
        if start_pos:
            idx += 1
        else:
            start_pos = {}
            idx = 0
            
        if idx == M:
            break
    
    print('Yes' if start_pos else 'No')
    
solve()
import math
n=int(input())
a=list(map(int,input().split()))

def get_sieve_of_eratosthenes(n):
    if not isinstance(n, int):
        raise TypeError('n is int type.')
    if n < 2:
        raise ValueError('n is more than 2')
    prime = []
    limit = math.sqrt(n)
    data = [i + 1 for i in range(1, n)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]


data = get_sieve_of_eratosthenes(max(a))
lst=[0]*(len(data))
for num in a:
    for i,datum in enumerate(data):
        if datum>num:
            break
        if num%datum==0:
            lst[i]+=1
            num//=datum

pair=True
st=True

for i in lst:
    if i>=2:
        pair=False
    if i==n:
        st=False

if pair:
    print("pairwise coprime")
elif st:
    print("setwise coprime")
else:
    print("not coprime")


### FIXED CODE ###

import math
n=int(input())
a=list(map(int,input().split()))
mxa=max(a)

def get_sieve_of_eratosthenes(mxa):
    fact = [0]*(mxa+1)
    limit = int(math.sqrt(mxa))
    for i in range(2,limit+1):
        if fact[i]!=0:
            continue
        else:
            fact[i]=i
            for j in range(i, mxa+1, i):
                if fact[j]==0:
                    fact[j]=i
    for i in range(2,mxa+1):
        if fact[i]==0:
            fact[i]=i

    return fact

fact = get_sieve_of_eratosthenes(mxa)

lst=[0]*(len(fact))
for i in range(n):
    divisor = set()
    while a[i]!=1:
        divisor.add(fact[a[i]])
        a[i]//=fact[a[i]]
    for d in divisor:
        lst[d]+=1

pair=True
st=True

for i in lst:
    if i>=2:
        pair=False
    if i==n:
        st=False
if pair:
    print("pairwise coprime")
elif st:
    print("setwise coprime")
else:
    print("not coprime")
n, k  = map(int, input().split())
A = list(map(int, input().split()))

# リストを扱いやすいように変形
def subtraction(x):
    return x - 1
A = list(map(subtraction, A))
# print(A)

# 通ったことのある場所を持っておく
ROUTE = [0]
t = A[0]
while not (t in ROUTE):
    ROUTE.append(t)
    t = A[t]


x=ROUTE.index(t) # ループのスタート地点
length = len(ROUTE) - x
# print(ROUTE, length)

if k < x:
    print(ROUTE[k]+1)
else:
    k = k - x
    s = k % length
    print(ROUTE[x + s]+1)


# 再び町1に戻ってくるまでの経路を調べる
# ROUTE = [0]
# t = A[0] # 現在地
# while t != 0:
#     ROUTE.append(t)
#     t = A[t]
# # print(ROUTE)

# length = len(ROUTE)
# print(ROUTE[k % length]+1)

### FIXED CODE ###

s = input()
t = input()
if s == t[:-1]:
    print("Yes")
else:
    print("No")
import collections
a = list(input())
b = list(input())
A = collections.Counter(a)
B = collections.Counter(b)
Asort = sorted(A.values())
Bsort = sorted(B.values())
if list(Asort.values()) == list(Bsort.values()):
  print("Yes")
else:
  print("No")

### FIXED CODE ###

import collections
a = list(input())
b = list(input())
A = collections.Counter(a)
B = collections.Counter(b)
Alist = list(A.values())
Blist = list(B.values())
Asort = sorted(Alist)
Bsort = sorted(Blist)
if Asort == Bsort:
  print("Yes")
else:
  print("No")
N=int(input())
A=list(map(int,input().split()))
l=[]
for i in range(N):
    if A[i]%2==0:
        l.append(A[i])
flag=True
for i in range(N):
    if l[i]%3==0 or l[i]%5==0:
        pass
    else:
        flag=False
if flag:
    print("APPROVED")
else:
    print("DENIED")

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
l=[]
for i in range(N):
    if A[i]%2==0:
        l.append(A[i])
flag=True
for i in range(len(l)):
    if l[i]%3==0 or l[i]%5==0:
        pass
    else:
        flag=False
if flag:
    print("APPROVED")
else:
    print("DENIED")
a,b=map(int,input().split())
c=0
d=0
res=0
i=0
while a>0 or b>0:
  r=1<<i
  c<<=1
  d<<=1
  c |= a&1
  d |= b&1
  if c<r:
    if d>=r:
      res |= ((d-r+1)%2)<<i
    else:
      res |= 0
  else:
    if d<r:
      res |= ((r<<1-c)%2)<<i
    else:
      res |= (((d-c+1)%r)%2)<<i
  a>>=1
  b>>=1
  i+=1
  
print(res)

### FIXED CODE ###

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

def f(x):
    i = 0
    res = 0 
    while (x>>i)>0:
        r = 1<<i
        if i == 0:
            if x%4 == 1 or x%4 == 2:
                res |= 1
            else:
                res |= 0
        else:
            d = x % (r<<1)
            if d >= r:
                res |= ((d-1)%2)<<i
        i += 1      
    return res

print(f(b)^f(a)^a)
while True:
    n, m = map(int, input().split())
    if n == 0:
        break
    a = sorted(map(int, input().split()))
    index = bisect.bisect_left(a, m) - 1
    if index <= 0:
        print("NONE")
        continue
    ans = 0
    for i in range(index, 0, -1):
        for j in range(i-1, -1, -1):
            if a[i] + a[j] <= m:
                ans = max(ans, a[i] + a[j])
    if ans:
        print(ans)
    else:
        print("NONE")


### FIXED CODE ###

while True:
    n, m = map(int, raw_input().split())
 
    if n == 0 and m == 0:
        break
 
    a = map(int, raw_input().split())
 
    ans = -1
 
    for i in range(n-1):
        for j in range(i+1, n):
            if a[i] + a[j] <= m:
                ans = max(ans, a[i] + a[j])
 
    print "NONE" if ans == -1 else ans
# REになった
# 各ルートの4方向で行ってないところを覚えるのではなく、すでに行ったマスのみをマークするようにする
# line input as int generator
def li():
    return map(int, input().split())


H, W = li()
# C = [input().split() for _ in range(H)]
C = [['' for _ in range(W)] for _ in range(H)]
# すでに行った道など、もう通らない道
route = []
for h in range(H):
    for w, c in enumerate(input()):
        C[h][w] = c
        if c == '#':
            route.append((h,w))
        # if h-1 >= 0:
        #     route[(h, w)].append((h - 1, w))
        # if h+1 < H:
        #     route[(h, w)].append((h + 1, w))
        # if w-1 >= 0:
        #     route[(h, w)].append((h, w - 1))
        # if w+1 < W:
        #     route[(h, w)].append((h, w + 1))
        if c == 's':
            start = (h, w)
# print(route)

def dfs(now):
    h, w = now
    # print(now)
    # if not ((0 <= h < H) and (0 <= w < W)):
    #     return False
    # print(route[now])
    if (h,w) in route:
        return False
    if C[h][w] == 'g':
        # OK!
        return True
    # elif C[h][w] == '#':
    #     return False
    else:
        # append
        route.append((h,w))
        if h-1 >= 0 and ((h-1,w) not in route):
            if dfs((h-1,w)):
                return True
        if h+1 < H and ((h+1,w) not in route):
            if dfs((h+1,w)):
                return True
        if w-1 >= 0 and ((h,w-1) not in route):
            if dfs((h,w-1)):
                return True
        if w+1 < W and ((h,w+1) not in route):
            if dfs((h,w+1)):
                return True
        return False

print('Yes' if dfs(start) else 'No')

### FIXED CODE ###

a = int(input())
s = input()
print(s if a>=3200 else 'red')
import sys

def cross(a, b):
	return (a.conjugate() * b).real
def dot(a, b):
	return (a.conjugate() * b).imag

def ccw(a, b, c):
	x = b - a
	y = c - a;
	if cross(x, y) > 0: return 1
	if cross(x, y) < 0: return -1
	if dot(x, y) < 0: return 2
	if abs(x) < abs(y): return -2
	return 0

def solve(l, p):
	x = ccw(l[0][0], l[0][1], p)
	x = int(x / abs(x))
	for i in l[1:]:
		y = ccw(i[0], i[1], p)
		y = int(y / abs(y))
		if x != y:
			print "NO"
			return
	print 'YES'

for line in sys.stdin:
	ax, ay, bx, by, cx, cy, px, py = map(float, line.split())
	a = complex(ax, ay)
	b = complex(bx, by)
	c = complex(cx, cy)
	p = complex(px, py)
	solve([(a, b), (b, c), (c, a)], p)

### FIXED CODE ###

import sys
def cross(a, b):
	return (a.conjugate() * b).imag
def dot(a, b):
	return (a.conjugate() * b).real
def ccw(a, b, c):
	x = b - a
	y = c - a;
	cr = cross(x, y)
	if cr != 0: return cr
	if dot(x, y) < 0: return 2
	if abs(x) < abs(y): return -2
	return 0
for line in sys.stdin:
	t = map(float, line.split())
	if len(t) == 0: continue
	a, b, c, p = map(complex, t[0::2], t[1::2])
	l = [(a, b), (b, c), (c, a)]
	x = cmp(ccw(l[0][0], l[0][1], p), 0)
	if all(cmp(ccw(i[0], i[1], p), 0) == x for i in l[1:]):
		print "YES"
	else:
		print "NO"
#ABC131c

import math
from functools import reduce

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


count_c=b//c - (a-1)//c
count_d=b//d - (a-1)//d
count_cd=b//(c*d//math.gcd(c,d)) - (a-1)//(c*d//math.gcd(c,d))

print(b-a+1-count_c-count_d+count_cd)



### FIXED CODE ###

#ABC131c 3.4以前ではmathではなくfractons

import fractions

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


count_c=b//c - (a-1)//c
count_d=b//d - (a-1)//d
count_cd=b//(c*d//fractions.gcd(c,d)) - (a-1)//(c*d//fractions.gcd(c,d))

print(b-a+1-count_c-count_d+count_cd)
s = input()

if s = "D D" or "H H":
  print("H")
else:
  print("D")

### FIXED CODE ###

s = input()

if s == "D D" or s == "H H":
  print("H")
else:
  print("D")
import itertools
 
def check(lis, a):
    return sum((i[3] for i in a if lis[i[1]-1]-lis[i[0]-1]==i[2]))
   
n, m, q = map(int, input().split())
a = ((int(i) for i in input().split(" ")) for j in range(q))
ans = 0
for i in itertools.combinations_with_replacement(range(m), n):
    ans = max(ans, check(i, a))
print(ans)

### FIXED CODE ###

import itertools

def check(lis, a):
    return sum([i[3] for i in a if lis[i[1]-1]-lis[i[0]-1]==i[2]])
   
n, m, q = map(int, input().split())
a = [[int(i) for i in input().split(" ")] for j in range(q)]
ans = 0
for i in itertools.combinations_with_replacement(range(m), n):
    ans = max(ans, check(i, a))
print(ans)
from scipy.sparse.csgraph import minimum_spanning_tree
from scipy.sparse import csr_matrix

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

x = []
y = []
for i, (ex, ey) in enumerate(xy):
    x.append([ex, i])
    y.append([ey, i])

x.sort()
y.sort()

u = []
v = []
c = []


def f(li):
    for (e1, i1), (e2, i2) in zip(li, li[1:]):
        dist = e2 - e1
        u.append(i1)
        v.append(i2)
        c.append(dist)


f(x)
f(y)

graph = csr_matrix((c, (u, v)))
mst = minimum_spanning_tree(graph)
ans = int(mst.sum())
print(ans)


### FIXED CODE ###

from scipy.sparse.csgraph import minimum_spanning_tree
from scipy.sparse import csr_matrix
from operator import itemgetter

n = int(input())
xy = [list(map(int, input().split())) + [i] for i in range(n)]

edge = set()
for key in (itemgetter(0), itemgetter(1)):
    xy.sort(key=key)
    for (x1, y1, i1), (x2, y2, i2) in zip(xy, xy[1:]):
        d = min(abs(x1 - x2), abs(y1 - y2))
        edge.add((i1, i2, d))

u, v, c = zip(*edge)

graph = csr_matrix((c, (u, v)), shape=(n, n), dtype=int)
mst = minimum_spanning_tree(graph, overwrite=True).astype(int)
ans = mst.sum()
print(ans)
while 1:
  k=input()-1
  if k==0:break
  print sum(map(int, raw_input().split()))/k

### FIXED CODE ###

while 1:
  k=input()-1
  if k==-1:break
  print sum(map(int, raw_input().split()))/k
t=list(map(int,input().split()))
a=list(map(int,input().split()))
b=list(map(int,input().split()))
p,q=[0],[0]
w=[]
for i in range(4):
    p.append(p[-1]+a[i%2]*t[i%2])
    q.append(q[-1]+b[i%2]*t[i%2])
    w.append(p[i+1]-q[i+1])
    if i==3:
        if len(set(w))!=4:
            print("infinity")
            exit()
        chk=0
        print(ans)
        exit()

### FIXED CODE ###

T1, T2 = map(int, input().split())
A1, A2 = map(int, input().split())
B1, B2 = map(int, input().split())
 
P = (A1 - B1) * T1
Q = (A2 - B2) * T2
if P > 0:
	P *= -1
	Q *= -1
 
if P + Q < 0:
	print(0)
elif P + Q == 0:
	print("infinity")
else:
	S = (-P) // (P + Q)
	T = (-P) % (P + Q)
	if T != 0:
		print(S * 2 + 1)
	else:
		print(S * 2)
N,K = map(int,input().split())
A = list(map(int,input().split()))

AA = A+A
last_i = {}
nx = [-1]*N
for i,a in enumerate(reversed(AA)):
    i = 2*N-i-1
    if i < N:
        nx[i] = (last_i[a] - i) % N + 1
    last_i[a] = i

visited = [-1]*N
visited[0] = 0
j = i = 0
while 1:
    p = nx[i]+N if nx[i]==1 else nx[i]
    j += p
    if visited[j%N] < 0:
        visited[j%N] = j
    else:
        break
    i = j%N
cycle = (j - visited[j%N]) // N

K %= cycle
j = i = 0
while 1:
    p = nx[i]+N if nx[i]==1 else nx[i]
    if j+p > N*K:
        break
    j += p
    i = j%N

if j%N == 0:
    print()
else:
    ans = []
    anss = set()
    for a in A[j%N:]:
        if a in anss:
            anss.remove(a)
            while ans[-1] != a:
                ans.pop()
            ans.pop()
        else:
            anss.add(a)
            ans.append(a)
    print(*ans)

### FIXED CODE ###

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

if N==1:
    print(A[0] if K%2 else '')
    exit()

AA = A+A
last_i = {}
nx = [-1]*N
for i,a in enumerate(reversed(AA)):
    i = 2*N-i-1
    if i < N:
        nx[i] = (last_i[a] - i) % N + 1
    last_i[a] = i

visited = [-1]*N
visited[0] = 0
j = i = 0
while 1:
    p = nx[i]+N if nx[i]==1 else nx[i]
    j += p
    if visited[j%N] < 0:
        visited[j%N] = j
    else:
        break
    i = j%N
cycle = (j - visited[j%N]) // N
K %= cycle
j = i = 0
while 1:
    p = nx[i]+N if nx[i]==1 else nx[i]
    if j+p > N*K:
        break
    j += p
    i = j%N

if j%N == 0:
    if K==1:
        print(*A)
    else:
        print()
else:
    ans = []
    anss = set()
    for a in A[j%N:]:
        if a in anss:
            while ans[-1] != a:
                anss.remove(ans[-1])
                ans.pop()
            anss.remove(a)
            ans.pop()
        else:
            anss.add(a)
            ans.append(a)
    print(*ans)
def boolean(a,b):
    if(abs(a[0] - b[0]) == abs(a[1] - b[1]) + abs(a[2] - b[2])):
        return 0
    else:
        return 1

N = int(input())
txy[0] = [0,0,0]
txy = [input() for i in range(1,N + 1)]
txy = [list(map(int, txy[i].split())) for i in range(N+ 1)]
ans = "Yes"
for i in range(1,N + 1):
    if(boolean(txy[i-1],txy[i])):
        ans = "No"
        break
print(ans)

### FIXED CODE ###

def boolean(a,b):
    D = abs(a[0] - b[0]) -abs(a[1] - b[1]) - abs(a[2] - b[2])
    if(D >= 0 and D %2 == 0):
        return 0
    else:
        return 1

N = int(input())
txy=[0 for i in range(N+1)]
txy[0]=[0,0,0]
for i in range(N):
    a=list(map(int,input().split()))
    txy[i+1]=a
ans = "Yes"
for i in range(1,N + 1):
    if(boolean(txy[i-1],txy[i])):
        ans = "No"
        break
print(ans)
N = int(input())
H = map(int, input().split())
 
f = True
 
for i in range(N - 1):
  if H[i + 1] - H[i] > 1:
    f = False
    break
    
if f:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

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

cur = H[0]

f = True
for hi in H[1:]:
  if cur <= hi:
    cur = hi
  elif cur <= hi + 1:
    cur = hi + 1
  else:
    f = False

if f:
  print('Yes')
else:
  print('No')
R, G, B, N = map(int, input().split())
ans = 0
for r in range(0, N, R):
    if r * R > N :
        break
    for g in range(0, N + 1int(N / G) + 1) :
        if r * R + g * G > N :
            break
        b = (N - r * R - g * G) / B
        if b >= 0 and b.is_integer() :
            ans += 1
print(ans)


### FIXED CODE ###

R, G, B, N = map(int, input().split())
ans = 0
for r in range(0, N + 1, R):
    if r > N :
        break
    for g in range(r, N + 1, G) :
        if g > N :
            break
        b = (N - g) / B
        if b >= 0 and b.is_integer() :
            ans += 1
print(ans)
N,*P=map(int,open(0);print(sum(P)-max(P)//2)

### FIXED CODE ###

N,*P=map(int,open(0).read().split());print(sum(P)-max(P)//2)
N = int(input())
p = [int(i) for i in input().split()]
count = 0
i = 0
while i < N:
    if p[i]-1==i:
        if p[i+1]-1==i+1:
            i += 1
            count += 1
        else:
            count += 1
    i += 1

print(count)

### FIXED CODE ###

N = int(input())
p = [int(i) for i in input().split()]
count = 0
i = 0
while i < N:
    if p[i]-1==i:
        if i+1 != N:
            if p[i+1]-1==i+1:
                i += 1
                count += 1
            else:
                count += 1
        else:
            count += 1
    i += 1

print(count)
[n,m]=list(map(int,input().split()))
ab=[]
for i in range(m):
    ab.append(list(map(int,input().split())))

chizu=[[] for i in range(n+1)]
ans=[0]*(n+1)
ans[1]=-1

for i in range(m):
    chizu[ab[i][0]].append(ab[i][1])
    chizu[ab[i][1]].append(ab[i][0])

kaisu=[chizu[1]]
for i in chizu[1]:
    ans[i]=1

error=0
j=-1
counter=len(chizu[1])
while True:
    j+=1
    for now in kaisu[j]:#スタートからj+1距離の点たちについて操作
        kari=[]
        for i in chizu[now]:#ある点から隣り合う点決めていく
           if ans[i]==0:#未到達であれば
                ans[i]=now
                kari.append(i)
                counter+=1
        kaisu.append(kari)
    if counter==n-1:
        break

if error==0:
    print("Yes")
    for i in range(2,n+1):
        print(ans[i])
    

elif error==1:
    print("No")

### FIXED CODE ###

[n,m]=list(map(int,input().split()))
ab=[]
for i in range(m):
    ab.append(list(map(int,input().split())))

chizu=[[] for i in range(n+1)]
ans=[0]*(n+1)
ans[1]=-1

for i in range(m):
    chizu[ab[i][0]].append(ab[i][1])
    chizu[ab[i][1]].append(ab[i][0])

kaisu=[chizu[1]]
for i in chizu[1]:
    ans[i]=1

error=0
j=-1
counter=len(chizu[1])
while True:
    j+=1
    if len(kaisu)<=j:
        error=0
        break
    for now in kaisu[j]:#スタートからj+1距離の点たちについて操作
        kari=[]
        for i in chizu[now]:#ある点から隣り合う点決めていく
           if ans[i]==0:#未到達であれば
                ans[i]=now
                kari.append(i)
                counter+=1
        kaisu.append(kari)
    if counter==n-1:
        break

if error==0:
    print("Yes")
    for i in range(2,n+1):
        print(ans[i])
    

elif error==1:
    print("No")
s = input()

weekday = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT']

idx = -1
for w in weekday:
  if w == s:
    idx = w

print(7 - idx)

### FIXED CODE ###

s = input()
 
weekday = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT']
 
idx = -1
for i, w in enumerate(weekday):
  if w == s:
    idx = i
 
print(7 - idx)
import math
x1,y1,x2,y2 = map(int,input().split())
print(math.sqrt(math.pow((x2-x1),2)+math.pow((y2-y1),2)))

### FIXED CODE ###

import math
x1,y1,x2,y2=map(float,input().split())
xx = (x2-x1)**2
yy = (y2-y1)**2
print(math.sqrt(xx + yy))
N = int(input())
answer = []
b = 0
for a in range(1,round(abs(N))):
  if N%a == 0:
    b = N//a
    answer.append(max(len(str(a)), len(str(b))))
print(min(answer))


### FIXED CODE ###

import math

N = int(input())
answer = []
b = 0
for a in range(1,round(math.sqrt(N))+1):
  if N%a == 0:
    b = N//a
    answer.append(max(len(str(a)), len(str(b))))
print(min(answer))
N,X = map(int, input().split())
M = []
S = 0
mini = X
for i in range(N):
    M.append(int(input()))
    S += M[i]
    if mini > M[i]:
        mini = M[i]

ans = 0
ans = N + int((X - S) / mini)

print(ans)

### FIXED CODE ###

S = input()

price = 700

if S[0] == "o": price += 100
if S[1] == "o": price += 100
if S[2] == "o": price += 100

print(price)
A = int(input())
B = int(input())

for i in range(25):
  if B <= A + (A-1)*i:
    print(i + 1)
    break


### FIXED CODE ###

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

if B ==1:
  print(0)

else:
  for i in range(19):
    if B <= A + (A-1)*i:
      print(i + 1)
      break
print(n//3)

### FIXED CODE ###

print(int(input())//3)
import numpy as np
N = int(input())
h = list(map(int, input().split()))
default = 9999
dp = [default] * N
def chmin(a, b):
  if a > b:
    a = b
    return True
  else:
    return False

def rec(i):
  global dp
  if i == o:
    return 0
  if dp[i] != default:
    return dp[i]
  chmin(dp[i], rec(i-1) + np.abs(h[i] - h[i-1]))
  if i > 1:
    chmin(dp[i], rec(i-2) + np.abs(h[i] - h[i-2]))
print(rec(N-1))

### FIXED CODE ###

import numpy as np
N = int(input())
h = list(map(int, input().split()))
dp = [9999] * N
dp[0] = 0
for i in range(1,N):
  if i<2:
    dp[i] = dp[i-1] + np.abs(h[i] - h[i-1])
  else:
    min1 = dp[i-2] + np.abs(h[i] - h[i-2])
    min2 = dp[i-1] + np.abs(h[i] - h[i-1])
    dp[i] = min(min1, min2)
print(dp[N-1])
import sys
input = sys.stdin.readline
sys.setrecursionlimit(200001)
N,Q = map(int,input().split())
ab = [ list(map(int,input().split())) for i in range(N-1) ]
px = [ list(map(int,input().split())) for i in range(Q) ]
dic = {}
dic2=[0]*N
dic3=[0]*N

for i in range(N-1):
    dic[i+1] = []
    dic[ab[i][0]].append(ab[i][1])
dic[N] = []
for i in range(Q):
    tmp1 = px[i][0]
    tmp2 = px[i][1]
    dic2[tmp1-1] += tmp2
def rec(now_node,prevval):
    nowval = prevval + dic2[now_node-1]
    dic3[now_node-1] = nowval
    for elem in dic[now_node]:
        rec(elem,nowval)
rec(1,0)
res = [str(dic3[i-1]) for i in range(1,N+1)]
print(' '.join(res))


### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
N,Q = map(int,input().split())
ab = [ tuple(map(int,input().split())) for i in range(N-1) ]
px = [ tuple(map(int,input().split())) for i in range(Q) ]
dic = {}
dic2=[0]*(N+1)
dic3=[0]*N

for i in range(N):
    dic[i+1] = []
for i in range(N-1):
    tmp1 = ab[i][0]
    tmp2 = ab[i][1]
    dic[tmp1].append(tmp2)
    dic[tmp2].append(tmp1)
ab=0
for i in range(Q):
    dic2[px[i][0]] += px[i][1]
px=0
def rec(now_node,prevval):
    nowval = prevval + dic2[now_node]
    dic3[now_node-1] = nowval
    tg_list = dic[now_node][:]
    for elem in tg_list:
        dic[elem].remove(now_node)
        rec(elem,nowval)
rec(1,0)
res = [str(dic3[i-1]) for i in range(1,N+1)]
print(' '.join(res))