Harryxun/stf_run huggingface dataset:
n = int(input())
s = list(map(int,input().split()))
S = s.sort()
S_re = S.reverse()
A = S_re[0:n+1:2]
B = S_re[1:n+1:2]
sum_A = sum(A)
sum_B = sum(B)
print(sum_A - sum_B)




### FIXED CODE ###

N = int(input())
a = list(map(int,input().split()))
b = sorted(a, reverse=True) 
Alice = 0
Bob = 0

for i in range(N):
  if i % 2 == 0:
    Alice += b[i]
  else:
    Bob += b[i]
    
print(Alice - Bob)
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

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

print(gcd(*a))

### FIXED CODE ###

import fractions
from functools import reduce

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

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

print(gcd(*a))
a, b = int(input().split())
if a % b == 0:
  print("odd")
else:
  print("even")

### FIXED CODE ###

a, b = map(int, input().split())
if (a*b) % 2:
  print('Odd')
else:
  print('Even')
# import itertools
# import math


def solve(N, H):
    for i in range(1, N):
        if H[i] < H[i+1]:
            H[i+1] -= 1
        elif H[i] > H[i+1]:
            return 'No'
    return 'Yes'


N = int(input())
# S = input()
# A, B = map(int, input().split())
H = list(map(int, input().split()))

# P = []
# S = []
# for i in range(N):
#     pp, ss  = map(int, input().split())
#     P.append(pp)
#     S.append(ss)

print(solve(N, H))


### FIXED CODE ###

# import itertools
# import math


def solve(N, H):
    for i in range(N - 1):
        if H[i] < H[i+1]:
            H[i+1] -= 1
        elif H[i] > H[i+1]:
            return 'No'
    return 'Yes'


N = int(input())
# S = input()
# A, B = map(int, input().split())
H = list(map(int, input().split()))

# P = []
# S = []
# for i in range(N):
#     pp, ss  = map(int, input().split())
#     P.append(pp)
#     S.append(ss)

print(solve(N, H))
n,q=map(int,input().split())
d = {}
ans = [0]*(n+1)
for i in range(n-1):
    sta,gol = map(int,input().split())
    if sta not in d:
        d[sta] = set() 
    d[sta].add(gol)

def dig(d_,sta_):
    ansset = set()
    if sta_ in d_:
        targetset = d_[sta_]
        for t in targetset:
            ansset.add(t)
            tmpset = dig(d_,t)
            ansset= ansset|tmpset
    return ansset
  
for sta in d:
    d[sta] = dig(d,sta)
#print(d)
    
def cal_(ans_,sta_,val_):
    ans_[sta_]+=val_
    if sta_ in d:
        targetset = d[sta_]
        for t in targetset:
            ans_[t]+=val_
    return ans_

for i in range(q):
    sta,val = map(int,input().split())
    ans = cal_(ans,sta,val)
    
for i in range(n):
    print(ans[i+1], " ",end="")

### FIXED CODE ###

n,q=map(int,input().split())
d = {}
ans = [0]*(n+1)
for i in range(n-1):
    sta,gol = map(int,input().split())
    d[gol] = sta

for i in range(q):
    sta,val = map(int,input().split())
    ans[sta]+=val
    

for i in range(n):
    gol = i+1
    if gol in d:
        ans[gol]+=ans[d[gol]]
    

for i in range(n):
    print(ans[i+1], " ",end="")
from time import time

def funcion():
    n = int(input())
    indice_anterior = -1
    total = 0

    for i in range(n):
        mayor = 0
        cadena = input()
        lista = cadena.split()
        cont = 0
        for j in lista:
            jnum = int(j)
            if (jnum > mayor) and cont != indice_anterior:
                mayor = jnum
            cont = cont + 1
        indice_anterior = lista.index(str(mayor))
        total = total + mayor
    print(total, tiempo_ejecucion)

def main():
    return(funcion())

if __name__ == "__main__":
    main()

### FIXED CODE ###

n = int(input())
h = []
for _ in range(n):
    a, b, c = [int(x) for x in input().split()]
    h.append((a, b, c))

vals = {}
a, b, c = h[0]
vals[(0, 'A')] = a
vals[(0, 'B')] = b
vals[(0, 'C')] = c

for i in range(1, n):
    a, b, c = h[i]
    vals[(i, 'A')] = max(vals[(i-1, 'B')], vals[(i-1, 'C')]) + a
    vals[(i, 'B')] = max(vals[(i-1, 'A')], vals[(i-1, 'C')]) + b
    vals[(i, 'C')] = max(vals[(i-1, 'B')], vals[(i-1, 'A')]) + c

print(max(vals[(n-1, 'A')], vals[(n-1, 'B')], vals[(n-1, 'C')]))
while True:
    n,x=map(int,input().split())
    if n==0 and x==0:break
    for i in range(1,n+1):
        for j in range(1,i):
            for k in range(1,j):
                if i+j+k==x :a=a+1
    print(a)


### FIXED CODE ###

while True:
    n,x=map(int,input().split())
    a=0
    if n==0 and x==0:break
    for i in range(1,n+1):
        for j in range(1,i):
            for k in range(1,j):
                if i+j+k==x:a+=1
    print(a)
import sys
import math
import itertools

def main():
    input = sys.stdin.readline
    N, M, Q = map(int, input().split())
    data = range(1, M+1)
    A = []
    for i in range(len(data)):
        for j in range(i, len(data)):
            for k in range(j, len(data)):
                A.append([data[i], data[j], data[k]])
    l = []
    m = 0
    for _ in range(Q):
        a, b, c, d = map(int, input().split())
        l.append([a, b, c, d])
    for a_list in A:
        tmp = 0
        for i in l:
            if a_list[i[1] -1] - a_list[i[0] - 1] == i[2]:
                tmp += i[3]
        if tmp > m:
            m = tmp
    return m


if __name__ == '__main__':
    print(main())



### FIXED CODE ###

import sys
import itertools

def main():
    input = sys.stdin.readline
    N, M, Q = map(int, input().split())
    data = range(1, M+1)
    A = list(itertools.combinations_with_replacement(range(1, M+1), N))
    l = []
    m = 0
    for _ in range(Q):
        a, b, c, d = map(int, input().split())
        l.append([a, b, c, d])
    for a_list in A:
        tmp = 0
        for i in l:
            if a_list[i[1] -1] - a_list[i[0] - 1] == i[2]:
                tmp += i[3]
        if tmp > m:
            m = tmp
    return m


if __name__ == '__main__':
    print(main())
import heapq


def _heappush_max(heap, item):
    heap.append(item)
    heapq._siftdown_max(heap, 0, len(heap) - 1)


def _heappop_max(heap):
    """Maxheap version of a heappop."""
    lastelt = heap.pop()    # raises appropriate IndexError if heap is empty
    if heap:
        returnitem = heap[0]
        heap[0] = lastelt
        heapq._siftup_max(heap, 0)
        return returnitem
    return lastelt


itemCount, ticketCount = map(int, input().split(' '))
prices = map(int, input().split(' '))

h = []
for price in prices:
    _heappush_max(h, price)

for i in range(ticketCount):
    price = _heappop_max(h)
    _heappush_max(h, price // 2)
total = 0
for price in h:
    total += price

print(total)

### FIXED CODE ###

import heapq


def _heappush_max(heap, item):
    heap.append(item)
    heapq._siftdown_max(heap, 0, len(heap) - 1)


def _heappop_max(heap):
    """Maxheap version of a heappop."""
    lastelt = heap.pop()    # raises appropriate IndexError if heap is empty
    if heap:
        returnitem = heap[0]
        heap[0] = lastelt
        heapq._siftup_max(heap, 0)
        return returnitem
    return lastelt


itemCount, ticketCount = map(int, input().split(' '))
prices = map(int, input().split(' '))

h = []
for price in prices:
    _heappush_max(h, price)

for i in range(ticketCount):
    price = _heappop_max(h)
    _heappush_max(h, price // 2)
total = 0
for price in h:
    total += price

print(total)
N, Q = [int(n) for n in input().split()]

tree_list = {n:[] for n in range(1, N+1)}
count_list = {n:0 for n in range(1, N+1)}

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

#print(tree_list)
#print(count_list)

def func(pn):
    count_list[pn] += x
    for k in tree_list[pn]:
        func(k)

for j in range(Q):
    p, x = [int(n) for n in input().split()]
    func(p)
    
#print(count_list)

print(' '.join([str(v) for v in count_list.values()]))

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
N, Q = [int(n) for n in input().split()]
tree_list = [[] for _ in range(N)]

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

score_list = [0] * N
for j in range(Q):
    p, x = [int(n) for n in input().split()]
    score_list[p-1] += x

reached = [False] * N
def dfs(v):
    reached[v] = True
    for next_v in tree_list[v]:
        if reached[next_v] == True:
            continue
        score_list[next_v] += score_list[v]
        dfs(next_v)
dfs(0)
print(*score_list)
import sys

input = sys.stdin.readline


class Node:
    def __init__(self, id):
        self.id = id
        self.next = []
        self.val = 0

    def set_node(self, node):
        self.next.append(node)


def add_val(node, val):
    global tree
    node.val += val
    if not node.next:
        return
    for i in node.next:
        add_val(tree[i], val)


n, q = map(int, input().split())
tree = [Node(id) for id in range(n + 1)]
query = [0 for _ 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())
    query[p] += x

for i in range(1, n + 1):
    val = query[i]
    if val != 0:
        add_val(tree[i], val)

print(*[tree[i].val for i in range(1, n + 1)])


### 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])
a,b=map(int,input().split())
n=b-a
summy=((n+1)*n)/2
print(int(summy-b))

### FIXED CODE ###

N=int(input())
print('ABC' if N<=999 else'ABD')
from typing import List


def diff_one(l: List[str]) -> bool:
    prev = l[0]

    for i in range(1, len(l)):
        if abs(ord(l[i]) - ord(prev)) >= 2:
            return False
        prev = l[i]

    return True


def comb(current: List[str], rest: List[str], target: int):
    if len(current) == target:
        yield current
    elif len(current) < target and len(rest) > 0:
        for i in range(len(current) + 1):
            yield from comb(current + [rest[i]], rest, target)


if __name__ == '__main__':
    n = int(input())
    alphabet = [str(chr(i)) for i in range(97, 97 + 26)]

    for perm in comb([], alphabet[:n], n):
        if diff_one(perm):
            print("".join(perm))


### FIXED CODE ###

def comb(current, mx, target: int):
    if len(current) == target:
        yield current
    elif len(current) < target and len(alphabet) > 0:
        for i in range(mx + 1):
            yield from comb(current + [chr(i + 97)], mx + 1 if i == mx else mx, target)


if __name__ == '__main__':
    n = int(input())
    alphabet = [str(chr(i)) for i in range(97, 97 + 26)]
    result = set()

    for perm in comb([], 0, n):
        print("".join(perm))
n=int(input())
a=int(input())
print([No,Yes][n-n//a＊500-a<0])


### FIXED CODE ###

n=int(input())
a=int(input())
print(['No','Yes'][n-(n//500)/(1/500)-a<=0])
#coding:utf-8
N = int(input())
preList = "".join(list(input().split()))
inList = "".join(list(input().split()))

def recon(l,r):
    if l >= r:
        return
    global pos
    c = preList[pos]
    index = inList.find(c)
    pos += 1
    recon(l,index)
    recon(index+1,r)
    
    global answer
    answer.append(c)

answer = []
pos = 0
recon(0,N)

answer = " ".join(answer)
print(answer)




### FIXED CODE ###

#coding:utf-8
N = int(input())
preList = list(input().split())
inList = list(input().split())

def recon(l,r):
    if l >= r:
        return
    global pos
    c = preList[pos]
    index = inList.index(c)
    pos += 1
    recon(l,index)
    recon(index+1,r)
    
    global answer
    answer.append(c)

answer = []
pos = 0
recon(0,N)

answer = " ".join(answer)
print(answer)
M, P = [int(i) for i in input().strip().split()]
dic={}

import numpy as np

def seachPrimeNum(N):
    max = int(np.sqrt(N))
    seachList = [i for i in range(2,N+1)]
    primeNum = []
    while seachList[0] <= max:
        primeNum.append(seachList[0])
        tmp = seachList[0]
        seachList = [i for i in seachList if i % tmp != 0]
    primeNum.extend(seachList)
    return primeNum

for i in seachPrimeNum(P):
    num = 0
    while P%i == 0:
        num = num +1
        P = P/i
        dic[i] = num
        
ans = 1
for i in dic:
    if M == 1:
        ans = P
        break
    elif dic[i] != 0:
        ans = ans*(i**(dic[i]//M))
print(ans)

### FIXED CODE ###

N, P = [int(i) for i in input().strip().split()]
dic={}
ans = 1

if N == 1:
    print(P)
    quit()
elif P == 1:
    print(1)
    quit()
    
for i in range(2,int(P**(1/2))+1):
    num = 0
    while P%i == 0:
        num = num +1
        P = int(P/i)
    dic[i] = num//N
    ans = ans*(i**(dic[i]))

print(ans)
from collections import Counter

N = int(input())

arr = list(map(int, input().split(' ')))

odd = arr[0::2]
even = arr[1::2]

odd_counter = Counter(odd)
even_counter = Counter(even)

odd_mode = odd_counter.most_common()[0][0]
even_mode = even_counter.most_common()[0][0]

odd_diff = (N / 2) - odd_counter.most_common()[0][1]
even_diff = (N / 2) - even_counter.most_common()[0][1]

if odd_mode != even_mode:
	print(int(odd_diff + even_diff))
else:
	odd_diff2 = (N / 2) - odd_counter.most_common()[1][1]
	even_diff2 = (N / 2) - even_counter.most_common()[1][1]
	if odd_diff2 > even_diff2:
		print(int(odd_diff + even_diff2))
	else:
		print(int(odd_diff2 + even_diff))


### FIXED CODE ###

from collections import Counter

N = int(input())

arr = list(map(int, input().split(' ')))

odd = arr[0::2]
even = arr[1::2]

odd_counter = Counter(odd)
even_counter = Counter(even)

odd_mode = odd_counter.most_common()[0][0]
even_mode = even_counter.most_common()[0][0]

odd_diff = (N / 2) - odd_counter.most_common()[0][1]
even_diff = (N / 2) - even_counter.most_common()[0][1]

if odd_mode != even_mode:
	print(int(odd_diff + even_diff))
elif odd_diff == 0:
	print(int(N / 2))
else:
	odd_diff2 = (N / 2) - odd_counter.most_common()[1][1]
	even_diff2 = (N / 2) - even_counter.most_common()[1][1]
	if odd_diff2 > even_diff2:
		print(int(odd_diff + even_diff2))
	else:
		print(int(odd_diff2 + even_diff))
a = map(int,input().split())
if a[0] >9:
  print(":(")
elif a[1] >9:
  print(":(")
else:
  print(""Yay!)

### FIXED CODE ###

a = list(map(int,input().split()))
if a[0] <=8 and a[1] <=8:
  print("Yay!")
else:
  print(":(")
n,m=map(int,input().split())
a=[]
b=[]
for i in range(n):
	a.append(input())
for i in range(m):
	b.append(input())

check = False
for i in range(n):
	if b[0]in a[i]:
		index=a[i].index(b[0])
		check=True
		for k in range(m):
			if i+k>=n:
				break
			if not b[k]in a[i+k] and a[i+k].index(b[k])!=index:
				check=False
				break
	if check:
		break

print("Yes" if check else "No")

### FIXED CODE ###

n, m = map(int, input().split())
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]

for i in a:
    for j in b:
        if j not in i:
            print("No")
            quit()
print("Yes")
import sys
a,v=map(int,input().split())
b,w=map(int,input().split())
t=int(input())
if v<=w:
    print('NO')
    sys.exit()
else:
    d=abs(a-b)
    s=v-w
    if d<=ts:
        print('YES')
        sys.exit()
print('NO')

### FIXED CODE ###

import sys
a,v=map(int,input().split())
b,w=map(int,input().split())
t=int(input())
if v<=w:
    print('NO')
    sys.exit()
else:
    d=abs(a-b)
    s=v-w
    if d<=t*s:
        print('YES')
        sys.exit()
print('NO')
a = [list(map(int, input().split())) for i in range(3)]
n = int(input())
b = [i for i in range(n)]

for i in range(3):
  for j in range(3):
    if a[i][j] in b:
      a[i][j] == 0
print("Yes" if any(i.count(0) == 3 for i in a))
print("Yes" if any(i.count(0) == 3 for i in zip(*a)))


### FIXED CODE ###

s = " 012 345 678 036 147 258 048 246 "
a = [input().split() for i in range(3)]
b = a[0] + a[1] + a[2]

for i in [input()for i in range(int(input()))]:
  if i in b:
    s = s.replace(str(b.index(i)), "")
print("Yes" if "  " in s else "No")
n = int(input().split("\"))
i = 0
list_n = [n]

for i in range(0, n-1):
	list_n[i] = int(input().split())

min = min(list_n)
max = max(list_n)
sum = sum(list_n)

print("%d %d %d" % (min, max, sum))

### FIXED CODE ###

n = int(input())
i = 0
#list_n = [n]

map_n = map(int, input().split())
list_n = list(map_n)

min = min(list_n)
max = max(list_n)
sum = sum(list_n)

print("%d %d %d" % (min, max, sum))
from collections import Counter
n,a,b,c = list(map(int, input().split()))
s = [[0]*2 for _ in range(n)]
S = []
for i in range(n):
  X = input()
  S += X
  cnt = 0
  for x in X:
    if x == 'A':
      s[i][cnt] = 0
    elif x == 'B':
      s[i][cnt] = 1
    else:
      s[i][cnt] = 2
    cnt += 1

if (a + b + c) == 0:exit(print('No'))
abc = [a,b,c]
x = s[0][0]
y = s[0][1]
if abc[x] == 0 and abc[y] == 0:
  exit(print('No'))


def con(x):
  if x == 0:
    return 'A'
  elif x == 1:
    return 'B'
  else:
    return 'C'

def sel(i):
  x = s[i][0]
  y = s[i][1]
  if abc[x] == 0:
    print(con(x))
    abc[x] += 1
    abc[y] -= 1
  elif abc[y] == 0:
    print(con(y))
    abc[y] += 1
    abc[x] -= 1
  else:
    nx = s[i+1][0]
    ny = s[i+1][1]
    if abc[nx] == 0:
      if nx == x:
        print(con(x))
        abc[x] += 1
        abc[y] -= 1
      elif nx == y:
        print(con(y))
        abc[y] += 1
        abc[x] -= 1 
    elif abc[ny] == 0:
      if ny == x:
        print(con(x))
        abc[x] += 1
        abc[y] -= 1
      elif ny == y:
        print(con(y))
        abc[y] += 1
        abc[x] -= 1              
      else:
        print(con(x))
        abc[x] += 1
        abc[y] -= 1          

print('Yes')
for i in range(n):
  sel(i)

### FIXED CODE ###


n,a,b,c = list(map(int, input().split()))
s = [[0]*2 for _ in range(n)]
S = []
for i in range(n):
  X = input()
  S += X
  cnt = 0
  for x in X:
    if x == 'A':
      s[i][cnt] = 0
    elif x == 'B':
      s[i][cnt] = 1
    else:
      s[i][cnt] = 2
    cnt += 1

if (a + b + c) == 0:exit(print('No'))
abc = [a,b,c]
ABC = ['A','B','C']


ans = [0] * n

def zero(xy):
  x = xy[0]
  y = xy[1]
  if abc[x] == 0 and abc[y] == 0:
    return -1,-1
  elif abc[x] == 0:
    return x,y
  elif abc[y] == 0:
    return y,x
  else:
    return 3,3

def main():
  global ans
  global abc
  
  for i in range(n):
    x,y = zero(s[i])
    if x == -1:exit(print('No'))
    if x == 3:
      if i < n-1:
        if s[i][1] in s[i+1]:
          x = s[i][1]
          y = s[i][0]
        else:
          x = s[i][0]
          y = s[i][1]
      else:
        x = s[i][0]
        y = s[i][1]
    ans[i] = x
    abc[x] += 1
    abc[y] -= 1

main()
print('Yes')
for i in range(n):
  print(ABC[ans[i]])
n,a,b,c = map(int,input().spilt())

ko = [int(input()) for i in range(n)]
INF = 10**9

 def dfs(q,w,e,r):
 	if q == n:
 		 return abs(a-w) + abs(b-e) + abs(c-r) - 30 if min(a,b,c) > 0 else INF
 	re0 = dfs(q+1,w,e,r)
 	re1 = dfs(q+1,w+ko[q],e,r) + 10
 	re2 = dfs(q+1,w,e+ko[ko],r) + 10
 	re3 = dfs(q+1,w,e,r+ko[q]) + 10
 	return min(re0,re1,re2,re3)

print(dfs(0,0,0,0))

### FIXED CODE ###

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

ko = [int(input()) for i in range(n)]
INF = 10**9

def dfs(q,w,e,r):
 	if q == n:
 		 return abs(a-w) + abs(b-e) + abs(c-r) - 30 if min(w,e,r) > 0 else INF
 	re0 = dfs(q+1,w,e,r)
 	re1 = dfs(q+1,w+ko[q],e,r) + 10
 	re2 = dfs(q+1,w,e+ko[q],r) + 10
 	re3 = dfs(q+1,w,e,r+ko[q]) + 10
 	return min(re0,re1,re2,re3)

print(dfs(0,0,0,0))
a, b, c, d = map(int, input().split())
c / b 
a / d
if a / d > c / d:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

a, b = map(int, input().split())
if a > b:
  print('safe')
else:
  print('unsafe')
n, k = map(int, input().split())
p = sorted(list(int(input()) for _ in range(n)))
print(sum(p[0:k]))

### FIXED CODE ###

n, k = map(int, input().split())
p = sorted(list(map(int, input().split())))
print(sum(p[0:k]))
n=int(input())
if n[1]=='7':
  print('Yes')
if n[2]=='7':
   print('Yes')
if n[3]=='7':
   print('Yes')
else:
   print('No')

### FIXED CODE ###

n=input()
if n[0]=='7':
  print('Yes') 
elif n[1]=='7':
  print('Yes')  
elif n[2]=='7':
  print('Yes')  
else:
   print('No')
class Dice:
    def __init__(self, data):
        self.data = data

    def move(self, direction):
        if direction == 'E':
            self.data[0],self.data[3], self.data[5], self.data[2] = \
                self.data[3],self.data[5], self.data[2], self.data[0] 
        elif direction == 'N':
            self.data[0],self.data[1], self.data[5], self.data[4] = \
                self.data[1],self.data[5], self.data[4], self.data[0]
        elif direction == 'S':
            self.data[0],self.data[1], self.data[5], self.data[4] = \
                self.data[4],self.data[0], self.data[1], self.data[5]
        elif direction == 'W':
            self.data[0],self.data[2], self.data[5], self.data[3] = \
                self.data[2],self.data[5], self.data[3], self.data[0]

    def getTop(self):
        return self.data[0]


dice = Dice.Dice(input().split())
cmd = input()
for i in range(len(cmd)):
    dice.move(cmd[i])
print(dice.getTop())

### FIXED CODE ###

class Dice:
    def __init__(self, data):
        self.data = data

    def move(self, direction):
        if direction == 'E':
            self.data[0],self.data[3], self.data[5], self.data[2] = \
                self.data[3],self.data[5], self.data[2], self.data[0] 
        elif direction == 'N':
            self.data[0],self.data[1], self.data[5], self.data[4] = \
                self.data[1],self.data[5], self.data[4], self.data[0]
        elif direction == 'S':
            self.data[0],self.data[1], self.data[5], self.data[4] = \
                self.data[4],self.data[0], self.data[1], self.data[5]
        elif direction == 'W':
            self.data[0],self.data[2], self.data[5], self.data[3] = \
                self.data[2],self.data[5], self.data[3], self.data[0]

    def getTop(self):
        return self.data[0]

dice = Dice(input().split())
cmd = input()
for i in range(len(cmd)):
    dice.move(cmd[i])
print(dice.getTop())
a=list(map(int,input().split()))
print(a.find(0)+1)


### FIXED CODE ###

a=list(map(int,input().split()))
print(a.index(0)+1)
n, a, b = (int(x) for x in input().split())
if a > n:
  print(n)
else:
  if a + b > n:
    print(a)
  else:
    print(a + (n % a))

### FIXED CODE ###

N, A, B = list(map(int,input().split()))
if A == 0:
  print(0)
elif A >= N:
  print(N)
elif A + B >= N:
  print(A)
else:
  print((N//(A+B))*A + min(A,N % (A+B)))
from collections import defaultdict
import bisect,sys
def inpl(): return [int(i) for i in input().split()]
H, W, N = inpl()
if not N:
    print(W)
    sys.exit()
A = []
B = defaultdict(lambda: [])
C = defaultdict(lambda: W)
for _ in range(N):
    x, y = inpl()
    A.append((x,y))
    B[y].append(x)
T = [0]*(H+1)
T[1] = 2
for i in range(1,H):
    if not B[i+1]:
        T[i+1] = T[i] + 1
        continue
    ctr = T[i]+1
    while True:
        if ctr in B[i+1]:
            ctr += 1
            continue
        break
    T[i+1] = min(ctr, W)
for x,y in A:
    if x >= T[y]:
        C[y] = min(C[y], x)
print(min([i-1 for i in C.values()]+[W]))

### FIXED CODE ###

from collections import defaultdict
import sys
def inpl(): return [int(i) for i in input().split()]
H, W, N = inpl()
if not N:
    print(H)
    sys.exit()
A = []
B = defaultdict(lambda: [])
C = defaultdict(lambda: H+1)
for _ in range(N):
    x, y = inpl()
    A.append((x,y))
    B[y].append(x)
T = [0]*(W+1)
T[1] = 2
for i in range(1,W):
    if not B[i+1]:
        T[i+1] = T[i] + 1
        continue
    ctr = T[i]
    while True:
        if ctr in B[i+1]:
            ctr += 1
            continue
        break
    T[i+1] = min(ctr+1, H+1)
for x,y in A:
    if x >= T[y]:
        C[y] = min(C[y], x)
print(min([i-1 for i in C.values()]+[H]))
x,n = map(int,input().split())
if x < a:
  print(0)
else:
  print(10)

### FIXED CODE ###

x,a = map(int,input().split())
if x < a:
  print(0)
else:
  print(10)