Harryxun/stf_run huggingface dataset:
import numpy as np
def main():
  N,M=map(int,input().split())
  str_list = [list(input().split()) for _ in range(M)]
  np_str_list=np.array(str_list)
  wacount=0
  for i in range(1,N+1):
    tgtarray=np_str_list[np.where(np_str_list[:,0]==str(i)),1][0]
    ac_index=np.where(tgtarray=='AC')[0][0]
    wacount=wacount+tgtarray[0:ac_index].shape[0]
  account=len(np_str_list[np_str_list[:,1]=='AC',0])
  print(wacount,account)

if __name__=='__main__':
  main()

### FIXED CODE ###

n,m=map(int,input().split())
ps=[list(input().split()) for i in range(m)]
pen=[0]*n#ペナ数
rig=[0]*n#ACorWA

for i in range(m):
    if ps[i][1]=="AC":
        rig[int(ps[i][0])-1]=1
    else:
        if rig[int(ps[i][0])-1]==0:
            pen[int(ps[i][0])-1]+=1
cnt1,cnt2=0,0
for i in range(n):
    if rig[i]==1:
        cnt1+=rig[i]
        cnt2+=pen[i]

print(str(cnt1)+" "+str(cnt2))
n, k = map(int, input().split())
list_num = [input() for i in range(k)]
price = n
while True :
    i = 0
    for i in range(len(str(price))) :
        if str(price)[i] in list_num :
            price += 1
            break
    else :
        print(price)
        break

### FIXED CODE ###

n, k = map(int, input().split())
list_num = [i for i in input().split()]
price = n
while True :
    i = 0
    for i in range(len(str(price))) :
        if str(price)[i] in list_num :
            price += 1
            break
    else :
        print(price)
        break
s = [input() for i in range(2)]
if s[0] = s[1][:-1]:
  print('Yes')
else:
  print("No")


### FIXED CODE ###

s = [input() for i in range(2)]
if s[0] == s[1][:-1]:
  print('Yes')
else:
  print("No")
N,L = map(int, input().split())
string_list = [input() for i in range(N)]
string_list.sort()
print(''.join(string_list)


### FIXED CODE ###

N,L = map(int, input().split())
string_list = [input() for i in range(N)]
string_list.sort()
print(''.join(string_list))
k=0
ans=[]
while k<1:
    if num<=26:
        ans.append((chr(96+num)))
        k=1
    elif num%26==0:
        num=(num//26-1)
        ans.append((chr(96+26)))
    else:
        ans.append((chr(96+num%26)))
        num=(num//26)

for i in range(len(ans)-1,-1,-1):
    if i ==0:
        print(ans[i])
    else:
        print(ans[i], end="")

### FIXED CODE ###

num = int(input())
k=0
ans=[]
while k<1:
    if num<=26:
        ans.append((chr(96+num)))
        k=1
    elif num%26==0:
        num=(num//26-1)
        ans.append((chr(96+26)))
    else:
        ans.append((chr(96+num%26)))
        num=(num//26)

for i in range(len(ans)-1,-1,-1):
    if i ==0:
        print(ans[i])
    else:
        print(ans[i], end="")
N,K=map(int,input().split())
A=list(map(int,input().split()))

genzaichi=1
rireki=[]
houmon=[0]*(N+1)

for i in range(1,K+1):
    genzaichi=A[genzaichi-1]
    if genzaichi not in rireki:
        houmon[genzaichi]=i
        rireki.append(genzaichi)
    else:
        roop_from=genzaichi
        x=houmon[roop_from]
        roop=i-x
        break

genzaichi=1
if K>=x+roop:
    K=K-x-roop
    genzaichi=roop_from

for i in range(N):
    genzaichi=A[genzaichi-1]

print(genzaichi)

### FIXED CODE ###

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

genzaichi=1
rireki=set()
houmon=[0]*(N+1)
flag=0

for i in range(1,K+1):
    genzaichi=A[genzaichi-1]
    if genzaichi not in rireki:
        houmon[genzaichi]=i
        rireki.add(genzaichi)
    else:
        roop_from=genzaichi
        x=houmon[roop_from]
        roop=i-x
        flag=1
        break

if flag==0:
    print(genzaichi)
else:
    genzaichi=roop_from
    K=(K-x)-((K-x)//roop)*roop
    for i in range(K):
        genzaichi=A[genzaichi-1]
    print(genzaichi)
import numpy as np
n=int(input())
ABC=[list(map(int,input().split())) for _ in range(n)]

dp=np.zeros((n,3),int)
for i in range(3):
  dp[0][i]=ABC[0][i]
for i in range(n-1):
  for j in range(3):
    dp[i+1][j]=max(dp[i][(j+1)%3]+ABC[i+1][j], dp[i][(j+2)%3]+ABC[i+1][j])
print(max(dp[-1]))

### FIXED CODE ###

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

x,y,z=0,0,0
for a,b,c in ABC:
  x,y,z=max(y,z)+a,max(x,z)+b,max(x,y)+c
print(max(x,y,z))
A = input().split()
S = []


for i in A:
    if i == '+' or i == '-' or i == '*':
        a = pop()
        b = pop()
        if i == '+': S.append(a+b)
        elif i == '-': S.append(a-b)
        else: S.append(a*b)
    else:
        x = int(i)
        S.append(x)

print(S[0])



### FIXED CODE ###

A = input().split()
S = []


for i in A:
    if i == '+' or i == '-' or i == '*':
        a = S.pop()
        b = S.pop()
        if i == '+': S.append(b+a)
        elif i == '-': S.append(b-a)
        else: S.append(b*a)
    else:
        x = int(i)
        S.append(x)
    #print(S)

print(S[0])
r = int(input())
pi = 3.141592653589793
A = float(pow(r, 2) * pi)
S = float(2 * pi * r)
print("{0:.8f}".format(A) + ' ' + "{0:.8f}".format(S))


### FIXED CODE ###

r = float(input())
pi = 3.141592653589793
A = float(pow(r, 2) * pi)
S = float(2 * pi * r)
print("{0:.8f}".format(A) + ' ' + "{0:.8f}".format(S))
import numpy as np

a,b=map(int,input().split())
A=np.array(sorted(list(map(int,input().split()))))
F=np.array(sorted(list(map(int,input().split())),reverse=True))

s=A.sum()

x=-1
y=10**12
while x+1<y:
  mid=(x+y)//2
  if s-np.minimum(A,mid//F).sum()<=K:
    x=mid
  else:
    y=mid
print(mid)

### FIXED CODE ###

import numpy as np

a,b=map(int,input().split())
A=np.array(sorted(list(map(int,input().split()))))
F=np.array(sorted(list(map(int,input().split())),reverse=True))

s=A.sum()

x=-1
y=10**12
while x+1<y:
  mid=(x+y)//2
  if s-np.minimum(A,mid//F).sum()<=b:
    y=mid
  else:
    x=mid
print(y)
""" AtCoder """

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

for i in range(N):
    A[i] -= i + 1

A.sort()

b = A[N//2]
bb = A[N//2 + 1]

ans = 0
ansans = 0

for a in A:
    ans += abs(a - b)
    ansans += abs(a - bb)

print(min(ans, ansans))


### FIXED CODE ###

""" AtCoder """

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

if N ==1:
    print(0)
    exit()

for i in range(N):
    A[i] -= i + 1

A.sort()

b = A[N//2]
bb = A[N//2 + 1]

ans = 0
ansans = 0

for a in A:
    ans += abs(a - b)
    ansans += abs(a - bb)

print(min(ans, ansans))
from sys import stdin

h,w,a,b = [int(x) for x in stdin.readline().rstrip().split()]

li = [[0 for _ in range(w)]for _ in range(h)]
if a > w//2 or b > h//2:
    print("No")
    exit()
elif h%a != 0 or w%b != 0:
    if a != 0 and b != 0:
        print("No")
        exit()
    else:
        if a == 0:
            a = 1
        if b == 0:
            b = 1
        count = 0
        for i in range(h):
            for s in range(a):
                li[i][s+a*count] = 1
            count += 1
            count = count%(h/a)
        for p in range(h):
            print(''.join(map(str, li[p])))
elif w%h != 0 and h%w != 0:
    print("No")
    exit()
else:
    count = 0
    for i in range(h):
        for s in range(a):
            li[i][s+a*count] = 1
        count += 1
        count = count%(h/a)
    li2 = [li[q][0] for q in range(h)]
    if li2.count(0) == b or li2.count(1) == b:
        for p in range(h):
            print(''.join(map(str, li[p])))
    else:
        print("No")

### FIXED CODE ###

from sys import stdin
h,w,b,a = map(int,stdin.readline().rstrip().split())
li = []
for i in range(a):
    s = "0"*b+"1"*(w-b)
    li.append(s)
for j in range(h-a):
    s = "1"*b+"0"*(w-b)
    li.append(s)
for i in li:
    print(i)
import itertools
N = input()
S = input()

count = 0

gr = itertools.groupby(s)
for key, group in gr:
    # print(list(group))
    count += 1
print(count)

### FIXED CODE ###

import itertools
N = input()
S = input()

count = 0

gr = itertools.groupby(S)
for key, group in gr:
    # print(list(group))
    count += 1
print(count)
max_v = 1000000000
min_v = -1000000000

n = input()
data = []
for i in range(N):
    data.append(input())

for r in data:
    max_v = max(max_v, r - min_v)                                               
    min_v = min(min_v, r)
    
print(max_v)

### FIXED CODE ###

n = int(input())
data = [int(input()) for i in range(n)]

min_value = data.pop(0)
earn_value = -1000000000000
for d in data:
    earn_value = max(d - min_value, earn_value)
    min_value = min(d, min_value) 
print(earn_value)
import re
input()
strorig = input()
closeFirst = re.search('^\)*',strorig).group(0)
openLast = re.search('\(*$',strorig).group(0)
strModified = '(' * len(list(closeFirst)) + strorig + ')' * len(list(openLast))
nums = [-1 if i == '(' else 1 for i in list(strModified)]
sumnums = sum(nums)
if sumnums < 0:
    result = strModified + ')' * (-1 * sumnums)
else:
    result = '(' * sumnums + strModified
print(result)


### FIXED CODE ###

num = input().split()
a = int(num[0]) * 100 + int(num[1]) * 10 + int(num[2])
if a % 4 == 0:
    print("YES")
else:
    print("NO")
import collections
import sys
input = sys.stdin.readline
N=int(input())
S=input()
str_list=tuple(S[:N])
result=0
c=collections.Counter(str_list)
RGB_list=c.most_common()

list1=[i for i, x in enumerate(str_list) if x == RGB_list[0][0]]
list2=[i for i, x in enumerate(str_list) if x == RGB_list[1][0]]
list3=[i for i, x in enumerate(str_list) if x == RGB_list[2][0]]
list23=[]
if RGB_list[2][0]==0 or RGB_list[1][0]==0:
    print(0)
else:
    for i in list3:
        for j in list2:
            list23+=[2*i-j,2*j-i,(i+j)/2]
    c1=collections.Counter(list23)
    for k in list1:
        for l in c1.keys():
            if k==l:
                result+=c1[l]
    print(int(RGB_list[0][1]*RGB_list[1][1]*RGB_list[2][1]-result))

### FIXED CODE ###

def main():
    import collections
    import sys
    sys.setrecursionlimit(5000000)
    input = sys.stdin.readline
    N=int(input())
    S=input()
    if N<=3:
        print(0)
    else:
        str_list=list(S[:N])
        result=0
        c=collections.Counter(str_list)
        RGB_list=c.most_common()

        if len(c)<3:
            print(0)

        else:

            list1=[i for i, x in enumerate(str_list) if x == RGB_list[0][0]]
            list2=[i for i, x in enumerate(str_list) if x == RGB_list[1][0]]
            list3=[i for i, x in enumerate(str_list) if x == RGB_list[2][0]]
            list23=[]

        
            for i in list3:
                for j in list2:
                    list23+=[2*i-j,2*j-i,(i+j)/2]
            c1=collections.Counter(list23)
            for k in list1:
                for l in c1.keys():
                    if k==l:
                        result+=c1[l]
            print(int(RGB_list[0][1]*RGB_list[1][1]*RGB_list[2][1]-result))

if __name__ == '__main__':
    main()
a,b=map(int,input())
i=b-a
print(i*(i+1)//2-b)

### FIXED CODE ###

a,b=map(int,input().split())
i=b-a
print(i*(i+1)//2-b)
A,B = map(int,input().split())
if A<=9 && B<=9:
  print(A*B)
else:
  print(-1)


### FIXED CODE ###

A,B = map(int,input().split())
if A<=9 and B<=9:
  print(A*B)
else:
  print(-1)
S = input
while len(S)!=0:
    S.pop()
    if len(S)%2==0 and S[0:len(S)/2]==S[len(S)/2:]:
        print(len(S))
        exit()

### FIXED CODE ###

S = list(input())
while len(S)!=0:
    S.pop()
    if len(S)%2==0 and S[:int(len(S)/2)]==S[int(len(S)/2):]:
        print(len(S))
        exit()
def main():
    import sys
    input = sys.stdin.readline

    N = list(map(int, list(input()[:-1])))
    K = int(input())

    if len(N) < K:
        print(0)

    if K == 1:
        print(N[0] + 9 * (len(N)-1))
    elif K == 2:
        count = 0
        for i in range(1, len(N)-1):
            count += 81 * i
        count += (N[0]-1) * 9 * (len(N)-1)

        count += 9 * (len(N)-2)

        count += N[1]
        print(count)
    else:
        count = 0
        for i in range(2, len(N)-1):
            count += 729 * i*(i-1)//2
        count += (N[0]-1) * 81 * (len(N)-1) * (len(N)-2) // 2

        count += 81 * (len(N)-2) * (len(N)-3) // 2

        count += (N[1]-1) * 9 * (len(N)-2)

        count += 9 * (len(N)-3)

        count += N[2]
        print(count)

main()

### FIXED CODE ###

def main():
    import sys
    input = sys.stdin.readline

    N = list(map(int, list(input()[:-1])))
    K = int(input())
    L = len(N)

    # dp[i][j][k]
    # i 桁目まで決めて
    # j 個の非0を使って
    # k = 0 : そこまでの桁はNと一致
    # k = 1 : そこまでの桁でN未満であることが確定
    dp = [[[0] * 2 for _ in range(K + 2)] for _ in range(L + 1)]
    dp[0][0][0] = 1

    from pprint import pprint
    for i, x in enumerate(N):
        for k in range(K + 1):
            # 桁ごと数え上げ
            if x == 0:
                # x == 0
                dp[i + 1][k][0] += dp[i][k][0]
            else:
                # x == 0
                dp[i + 1][k][1] += dp[i][k][0]
                # 0 < n < x
                dp[i + 1][k + 1][1] += dp[i][k][0] * (x - 1)
                # n == x
                dp[i + 1][k + 1][0] += dp[i][k][0]
            # N未満で次の桁に1~9を入れる
            dp[i + 1][k + 1][1] += dp[i][k][1] * 9
            # N未満で次の桁に0を入れる
            dp[i + 1][k][1] += dp[i][k][1]

    print(sum(dp[L][K]))  

if __name__ == '__main__':
    main()
from collections import defaultdict

n,m = (int(x) for x in input().split())
visited = [False for _ in range(n)]
graph = defaultdict(list)



for _ in range(m):
    u,v = (int(x)-1 for x in input().split())
    graph[u].append(v)
    graph[v].append(u)

def dfs(node):
    if not visited[node]:
        visited[node] = True
        for next_node in graph[node]:
            dfs(next_node)

ans = -1
for i in range(n):
    if not visited[i]:
        dfs(i)
        ans += 1
print(ans)

### FIXED CODE ###

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

from collections import defaultdict

n,m=map(int,input().split())
visited=[0]*n
d=defaultdict(list)
def dfs(n):
    visited[n]=1
    #print(visited)
    for i in d[n]:
        if visited[i]==0:
            dfs(i)

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

r=-1
for i in range (n):
    if visited[i]==0:
        dfs(i)
        r+=1
print(r)
import math

r= map(int, raw_input().split())

a=float(r)*float(r)*math.pi
b=2*float(r)*math.pi
print a,b

### FIXED CODE ###

import math
r=input()
a=r*r*math.pi
b=2*r*math.pi
print "%f %f"%(a,b)
N, K = list(map(int, input().split()))
a = list(map(int, input().split()))

b=[]
for i in range(N):
    for j in range(i+1,N+1):
        b.append(sum(a[i:j]))

b.sort()
b=b[::-1]
for sp in range(0,N+1-K):
    if [len(bin(b[i])[2:]) for i in range(sp,sp+K)] == [len(bin(b[sp])[2:])for i in range(sp,sp+K)]:
        break
s=b[sp:sp+K]
if K==1:
    tmp=s[0]
else:
    tmp=s[0]&s[1]
    for i in range(2,K):
        tmp=tmp&s[i]

print(tmp)

### FIXED CODE ###

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

mean = sum(a)/N
ind = None
min = None
for i in range(N):
    tmp=abs(mean-a[i])
    if min is None:
        min=tmp
        ind=i
    else:
        if tmp<min:
            min=tmp
            ind=i

print(ind)
INF=1000100
dp=[INF]*(100010)
n=int(input())
h=list(map(int,input().split()))

def rec(i):
    if dp[i]<INF:return dp[i]

    if i==0:return 0

    res=INF
    res=min(res,rec(i-1)+abs(h[i]-h[i-1]))
    if i>1:res=min(res,rec(i-2)+abs(h[i]-h[i-2]))
    dp[i]=res
    return dp[i]

print(rec(n-1))

### FIXED CODE ###

n=int(input())
h=list(map(int,input().split()))
dp=[1000000000]*(n)
dp[0]=0
dp[1]=abs(h[1]-h[0])
for i in range(2,n):
    dp[i]=min(dp[i-1]+abs(h[i-1]-h[i]),dp[i-2]+abs(h[i-2]-h[i]))
print(dp[n-1])
inputa = input().split()
inputa[0] = int(inputa[0])
inputa[1] = int(inputa[1])
tempa = []
tempb = float(inputa[1])
tempc = []
res = float(0)
if tempb == 1:
  print(1)
  exit()
while tempb > 1:
  if tempb <= inputa[0]:
    tempa.append(inputa[0] - tempb + 1)
  else:
    tempa.append(0)
    
  tempb /= 2

i = 1
tempc.append(tempa[0])
while i <= len(tempa):
  tempc.append(tempa[i] - tempa[i - 1])
  i += 1

for i, num in enumerate(tempa):
  res += num / inputa[0] / (2 ** i)

print(res)

### FIXED CODE ###

import math
inputa = input().split()
inputa[0] = int(inputa[0])
inputa[1] = int(inputa[1])
tempa = []
tempb = float(inputa[1])
tempc = []
res = float(0)
if tempb == 1:
	print(1)
	exit()
while tempb >= 0.5:
	#print(tempb)
	if tempb <= inputa[0]:
		tempa.append(math.floor(inputa[0] - tempb + 1))
	else:
		tempa.append(0)
	tempb /= 2

i = 1
tempc.append(tempa[0])
#print(tempa)
while i < len(tempa):
	tempc.append(tempa[i] - tempa[i - 1])
	i += 1
#print(tempc)
for i, num in enumerate(tempc):
	#print(num / inputa[0] / (2 ** i))
	res += num / inputa[0] / (2 ** i)

print(res)
N = int(input())
ans = 1
while N > ans:
  ans = ans * N2
print(int(ans/2))


### FIXED CODE ###

N = int(input())
ans = 1
while N > ans:
  ans = ans * 2
ans = N if ans == N else ans//2
print(ans)
x,k,d = [int(x) for x in input().split()]
t = abs(int(x/d))
if x < 0:
    d = -d
if t >= k:
    print(x-d*k)
elif t == 0:
    if k % 2 == 0:
        print(abs(x))
    else:
        print(min(abs(x-d),abs(x+d)))
elif t < k:
    if abs(x-d*t) < abs(x-d*t-d):
        if (t-k)%2==0:
            print(abs(x-d*t))
        else:
            print(min(abs(x-d*t+d),abs(x-d*t-d)))
    elif abs(x-d*t) = abs(x-d*t-d):
        print(abs(x-d*t))
    else:
        if (t-k-1)%2==0:
            print(abs(x-d*t-d))
        else:
            print(min(abs(x-d*t),abs(x-d*t-2*d)))


### FIXED CODE ###

x,k,d = [int(x) for x in input().split()]
t = abs(int(x/d))
if x < 0:
    d = -d
if t >= k:
    print(abs(x-d*k))
elif t == 0:
    if k % 2 == 0:
        print(abs(x))
    else:
        print(min(abs(x-d),abs(x+d)))
elif t < k:
    if abs(x-d*t) < abs(x-d*t-d):
        if (k-t)%2==0:
            print(abs(x-d*t))
        else:
            print(min(abs(x-d*t+d),abs(x-d*t-d)))
    elif abs(x-d*t) == abs(x-d*t-d):
        print(abs(x-d*t))
    else:
        if (k-t-1)%2==0:
            print(abs(x-d*t-d))
        else:
            print(min(abs(x-d*t),abs(x-d*t-2*d)))
from sys import stdin
a,b,x = [int(x) for x in stdin.readline().rstrip().split()]

if a>x or:
  print('NO')
elif a<x and x-a>b:
  print('NO')
else:
  print('YES')

### FIXED CODE ###

from sys import stdin
a,b,x = [int(x) for x in stdin.readline().rstrip().split()]
 
if a>x:
  print('NO')
elif a<x and (x-a)>b:
  print('NO')
else:
  print('YES')
from collections import deque
from collections import Counter
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
#pypyではscipy, numpyは使えない
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
#from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
#import numpy as np
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')

def main():
  a, b = map(int, readline().split())
  print(max(a+b, a-b, a*b)
  
  
if __name__ == '__main__':
  main()

### FIXED CODE ###

from collections import deque
from collections import Counter
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
#pypyではscipy, numpyは使えない
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
#from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
#import numpy as np
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')

def main():
  a, b = map(int, readline().split())
  print(max(a+b, a-b, a*b))
  
  
if __name__ == '__main__':
  main()
import numpy as np
N = input()
kuku_array = np.zeros((9, 9))
for i in range(9):
  for j in range(9):
    kuku_array[i][j] = i*j
if np.any(kuku_array = N) == True:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

import numpy as np
N = int(input())
kuku_array = np.zeros((9, 9))
for i in range(1,10):
  for j in range(i,10):
    kuku_array[i-1][j-1] = i*j
if np.any(kuku_array == N) == True:
  print('Yes')
else:
  print('No')
# -*- coding: utf-8 -*-
N = int(input())
counter = 0
arr = [int(i) for i in input().split(" ")]
flag = True
while 0 < len(arr):
    counter = counter + 1
    for i in arr:
        arr[i] = arr[i] << 1
        if arr[i] == 1:
            pass
        else:
            ret.append(arr[i])
    arr = ret

print(counter)


### FIXED CODE ###

# -*- coding: utf-8 -*-
N = int(input())
counter = 0
arr = [int(i) for i in input().split(" ")]
flag = True
while flag:
    ret = []
    for i in range(len(arr)):
        if arr[i] % 2 == 1:
            flag = False
            break
        arr[i] = arr[i] >> 1
        if arr[i] % 2 == 1:
            counter = counter + 1
            flag = False
            break
    if flag:
        counter = counter + 1

print(counter)
if a < 3200:
	print(a)
else:
	print(s)

### FIXED CODE ###

a=int(input())
s=input()
if a >= 3200:
  print(s)
else:
  print('red')
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[4],self.data[5],self.data[1] = \
                    self.data[1],self.data[0],self.data[4],self.data[5]
        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())

### 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[4],self.data[5],self.data[1] = \
                    self.data[1],self.data[0],self.data[4],self.data[5]
        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())