Harryxun/stf_run huggingface dataset:
L = int(input())
r = 0
while 2 ** r <= L:
    r += 1
r -= 1

ans = []
N = r + 1
for i in range(1, N):
    ans.append((i, i + 1, 0))
    ans.append((i, i + 1, 2 ** (i - 1)))
    
for t in range(N - 1, 0, -1):
    if L - 2 ** (t - 1) >= 2 ** r:
        ans.append((L - 2 ** (t - 1)))
        L -= 2 ** (t - 1)
        
print(N, len(ans))
for i in ans:
    print(i[0], i[1], i[2])

### FIXED CODE ###

L = int(input())
r = 0
while 2 ** r <= L:
    r += 1
r -= 1

ans = []
N = r + 1
for i in range(1, N):
    ans.append((i, i + 1, 0))
    ans.append((i, i + 1, 2 ** (i - 1)))
    
for t in range(N - 1, 0, -1):
    if L - 2 ** (t - 1) >= 2 ** r:
        ans.append((t, N, L - 2 ** (t - 1)))
        L -= 2 ** (t - 1)
        
print(N, len(ans))
for i in ans:
    print(i[0], i[1], i[2])
n, k = map(int, input())
if n % k == 0:
    print("0")
else:
    print("1")

### FIXED CODE ###

n, k = map(int, input().split())
if n % k == 0:
    print("0")
else:
    print("1")
#Multiple Clocks
import math
N = int(input())
T = int(input())
for i in range (N-1):
    t = int(input())
    T = t*T // math.gcd(t,T)
print(T)

### FIXED CODE ###

#Multiple Clocks
import fractions
N = int(input())
T = int(input())
for i in range (N-1):
    t = int(input())
    T = t*T // fractions.gcd(t,T)
print(T)
N = int(input())
A = list(map(int, input().split()))
x = 1
y = 10**18

x = np.prod(A)
if x > y:
    print("-1")
else:
    print(x)


### FIXED CODE ###

N = int(input())
l = list(map(int,input().split()))
l.sort()
ans = 1
rec = True
for i in range(N):
    ans = ans * l[i]
    if ans > 10**18:
        rec = False
        break

if rec:
    print(ans)
else:
    print('-1')
n,x=map(int,input().split())
l=list(map(int,input().split()))
d=[0]

for i in range(1,n+1):
    temp=d[i-1]+l[i-1]
    if temp>x:
        ans=i
        break
    d.append(temp)

print(ans)

### FIXED CODE ###

n,x=map(int,input().split())
l=list(map(int,input().split()))
d=[0]

for i in range(1,n+1):
    temp=d[i-1]+l[i-1]
    if temp>x:
        ans=i
        break
    d.append(temp)

else:
    ans=n+1

print(ans)
l = int(input())
result = 0

if l % 3 == 0:
    result = (l /3) ** 3
else:
    


print(result)
    

### FIXED CODE ###

l = int(input())
result = ((l /3) ** 3)
print(round(result,7))
import sys
input = sys.stdin.readline
import numpy as np

def print_sub(A, m, c):
    A -= 1
    print(m -np.nonzero(A)[0].size)
    c +=1
    if c < m:
        return print_sub(A, m, c)
    else:
        return

n= int(input())
A = [int(a) for a in input().split()]
A = np.array(A)
c = 0
print_sub(A, n-1, c)

print("0")


### FIXED CODE ###

import sys
input = sys.stdin.readline

n = int(input())
A = [int(a) for a in input().split()]

sub_list = [0] *n

for a in A:
  sub_list[a-1] +=1

for i in range(n):
  print(sub_list[i])
input(a)
 
a * 2 + a * 3 + a * 4 = Z
	print("Z")

### FIXED CODE ###

a = int(input())
print(a + a**2 + a**3)
n,m=list(map(int,input().split()))
a=list(map(int,input().split()))
b=[]
for i in range(m):
    p=list(map(int,input().split()))
    b.append(p)
b.sort(key=lambda x:-x[1])
a.sort()
wes=-1
i=0
s=0
g=len(b)
while i<g:
    wes+=b[i][0]
    if a[wes]>=b[i][1]:
        wes-=b[i][0]
        wes+=1
        break
    else:
        s+=b[i][0]*b[i][1]
        i+=1
if i!=g:
    for j in range(b[i][0]):
        if a[wes+j]<b[i][1]:
            a[wes+j]=b[i][1]
    f=a[wes:]
    s+=sum(f)
print(s)

### FIXED CODE ###

n,m=list(map(int,input().split()))
a=list(map(int,input().split()))
b=[]
s=0
for i in range(m):
    p=list(map(int,input().split()))
    b.append(p)
    s+=p[0]
b.sort(key=lambda x:-x[1])
a.sort()
if s>n:
    s=n
c=[]
i=0
sun=0
while sun<s:
    for j in range(b[i][0]):
        c.append(b[i][1])
    sun+=b[i][0]
    i+=1
for u in range(s):
    if a[u]<c[u]:
        a[u]=c[u]
    
print(sum(a))
l = [[], [], []]
ans = []
for i in range(3):
  for j in range(8):
    s = raw_input().split()
    l[i].append(float(s[1]), int(s[0]))
for i in range(3):
  l[i].sort()
  l[i].reverse()
  ans.append(l[i].pop(0))
  ans.append(l[i].pop(0))
l = l[0] + l[1] + [2]
l.sort()
l.reverse()
ans.append(l.pop(0))
ans.append(l.pop(0))
for n in ans:
  print str(n[1]) + " " + str(n[0])

### FIXED CODE ###

l = [[], [], []]
ans = []
for i in range(3):
  for j in range(8):
    s = raw_input().split()
    l[i].append([float(s[1]), int(s[0])])
for i in range(3):
  l[i].sort()
  ans.append(l[i].pop(0))
  ans.append(l[i].pop(0))
l = l[0] + l[1] + l[2]
l.sort()
ans.append(l.pop(0))
ans.append(l.pop(0))
for n in ans:
  print str(n[1]) + " " + str(n[0])
R = int(input())
if R < 1200:
    print("ABC")
elif R < 2800:
    print(ARC)
else:
    print(AGC)


### FIXED CODE ###

R = int(input())
if R < 1200:
    print("ABC")
elif R < 2800:
    print("ARC")
else:
    print("AGC")
import sys
lw = sys.argv[1]
return lw == "ABC" ? "ARC" : "ABC"


### FIXED CODE ###

tw ="ABC" if input().startswith("ARC") else "ARC"
print(tw)
# -*- coding: utf-8 -*-
from math import factorial
 
n = int(input())
strlist = []
for i in range(n):
    strlist.append(sorted(str(input())))
strlist.sort()

allcount = 0
while (len(strlist) > 0):
    count = 1
    while (len(strlist) > 0):
        if(len(strlist) > 1 and strlist[-1] == strlist[-2]):
            count += 1
            strlist.pop()
        else:
            strlist.pop()
            if(count > 1):
                allcount += int(factorial(count) / factorial(2) / factorial(count-2))
            break
print(allcount)

### FIXED CODE ###

n = int(input())
strdict = {}
count = 0
for i in range(n):
    sortedstr = "".join(sorted(str(input())))
    strdict.setdefault(sortedstr, 0)
    count += strdict[sortedstr]
    strdict[sortedstr] += 1
print(count)
import sys
sys.setrecursionlimit(10**6)  

N, M = map(int, input().split())
G = {k:[] for k in range(N)}
for _ in range(M):
  a, b = map(int, input().split())
  G[a-1].append(b-1)
  G[b-1].append(a-1)


def rel_side(v, G):  # 任意の頂点から、他のすべての頂点を訪問したかどうかを確認する関数
  if all(vis):
    return 1
  r = 0
  for side in G[v]:
    if not vis[side]:
      vis[side] = True)
      r += rel_side(side, G)
  return r


bridge = 0
for i in range(N):
  for j, k in enumerate(G[i]):
    vis = [False] * N
    vis[i] = True
    pop1 = G[i].pop(j)
    idx = G[pop1].index(i)
    pop2 = G[pop1].pop(idx)
    if not rel_side(i, G):
      bridge += 1
    # print(vis, rel_side(i, G))
    G[i].insert(j, pop1)
    G[pop1].insert(idx, pop2)
    

print(bridge // 2)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)  

N, M = map(int, input().split())
G = {k:[] for k in range(N)}
for _ in range(M):
  a, b = map(int, input().split())
  G[a-1].append(b-1)
  G[b-1].append(a-1)


def rel_side(v, G):  # 任意の頂点から、他のすべての頂点を訪問したかどうかを確認する関数
  if all(vis):
    return 1
  r = 0
  for side in G[v]:
    if not vis[side]:
      vis[side] = True
      r += rel_side(side, G)
  return r


bridge = 0
for i in range(N):
  for j, k in enumerate(G[i]):
    vis = [False] * N
    vis[i] = True
    pop1 = G[i].pop(j)
    idx = G[pop1].index(i)
    pop2 = G[pop1].pop(idx)
    if not rel_side(i, G):
      bridge += 1
    # print(vis, rel_side(i, G))
    G[i].insert(j, pop1)
    G[pop1].insert(idx, pop2)
    

print(bridge // 2)
n,m=map(int,input().split())
ans=["a"]*n
for i in range(m):
    s,c=map(int,input().split())
    if ans[s-1]=="a" or ans[s-1]==c:
        ans[s-1]=c 
        pans="0"
        if s==1 and c==0:
            pans="-1"
            break
    else:
        pans="-1"
        break
                
ans = [str(i) for i in ans]
if pans != "-1":
    pans="".join(ans)
    if pans[0]=="0":
        pans='1' + pans[1:]
print(pans.replace("a","0"))

### FIXED CODE ###

n,m=map(int,input().split())
d=["a"]*n
ans=""
if n==1 and m==0:
    print(0)
    exit()
for i in range(m):
    s,c=map(str,input().split())
    if s=="1" and c=="0" and n==1:
        print(0)
        exit()
    s=int(s)
    if d[s-1]=="a" or d[s-1]==c:
        d[s-1]=c #置き換え
    else:
        ans="-1"
        print(ans)
        break
if d[0]!="0" and ans!="-1":
    if d[0]=="a" or d[0]=="0":
        print("".join(["1"]+d[1:]).replace("a","0"))
    else:
        print(("".join(d)).replace("a","0"))
elif d[0]=="0":
    print(-1)
n=int(input())
edge=[[] for i in range(n)]
for i in range(n-1):
    x,y,z=map(int,input().split())
    edge[x-1].append([y-1,z])
    edge[y-1].append([x-1,z])
q,k=map(int,input().split())
dist=[-1]*n
def dfs(node,d):
    dist[node]=d
    for i in edge[node]:
        if dist[i[0]]==-1:
            dfs(i[0],d+i[1])
dfs(k-1,0)
for i in range(q):
    x,y=map(int,input().split())
    print(dist[x-1]+dist[y-1])

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)
n=int(input())
edge=[[] for i in range(n)]
for i in range(n-1):
    x,y,z=map(int,input().split())
    edge[x-1].append([y-1,z])
    edge[y-1].append([x-1,z])
q,k=map(int,input().split())
dist=[-1]*n
def dfs(node,d):
    dist[node]=d
    for i in edge[node]:
        if dist[i[0]]==-1:
            dfs(i[0],d+i[1])
dfs(k-1,0)
for i in range(q):
    x,y=map(int,input().split())
    print(dist[x-1]+dist[y-1])
n , m = map(int, input().split())
s = input()
t = input()

def gcd(num1,num2):
    r=1
    while r!=0:
        r=num1%num2
        num1=num2
        num2=r
    return num1

def lcm(num1,num2):
    return num1*num2//gcd(num1,num2)

g1 = lcm(n,m)
g2 = lcm(g1//n,g1//m)

s*=g1//n
t*=g1//m

for i in range(g1//g2):
    if s[g2*i]!=t[g2*i]:
        print('-1')
        exit()
print(g1)


### FIXED CODE ###

n , m = map(int, input().split())
s = input()
t = input()

def gcd(num1,num2):
    r=1
    while r!=0:
        r=num1%num2
        num1=num2
        num2=r
    return num1

def lcm(num1,num2):
    return num1*num2//gcd(num1,num2)

g1 = lcm(n,m)
g2 = lcm(g1//n,g1//m)

for i in range(g1//g2):
    if s[g2*n*i//g1]!=t[g2*m*i//g1]:
        print('-1')
        exit()
print(g1)
N=int(input())
S=input()
T=input()
x = [S[i:i+1] for i in range(len(S))]
y = [T[i:i+1] for i in range(len(T))]

### FIXED CODE ###

N = int(input())
S, T = map(str, input().split())
 
s = ''
 
for i in range(N):
    s = s + S[i] + T[i]
 
print(s)
import math

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

# Cで割り切れる数
div_c_min = math.ceil(A/C)
div_c_max = math.floor(B/C)
div_c_num = div_c_max - div_c_min + 1
#print(div_c_min, div_c_max)
#print(div_c_num)

# Dで割り切れる数
div_d_min = math.ceil(A/D)
div_d_max = math.floor(B/D)
div_d_num = div_d_max - div_d_min + 1
#print(div_d_min, div_d_max)
#print(div_d_num)

# 最小公倍数
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

# CとDの公倍数で割り切れる数
div_cd_min = math.ceil(A / lcm(C, D))
div_cd_max = math.floor(B / lcm(C, D))
div_cd_num = div_cd_max - div_cd_min + 1
#print(div_cd_min, div_cd_max)
#print(div_cd_num)

numAtoB = B - A + 1
print(numAtoB - (div_c_num + div_d_num - div_cd_num))

### FIXED CODE ###


import math
import fractions

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

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

# CとDの最小公倍数で割り切れる数
lcm = lcm(C, D)

ans = B-A+1 - (B//C-(A-1)//C) - (B//D-(A-1)//D) + (B//(lcm)-(A-1)//(lcm))

print(ans)
S=input()
ans=[]
for i in range(len(S)):
  if S[i] in ["0","1"]:
    ans.append(S[i])
  else:
    ans.pop(-1)
print("".join(ans))

### FIXED CODE ###

S=input()
ans=[]
for i in range(len(S)):
  if S[i] in ["0","1"]:
    ans.append(S[i])
  elif len(ans) > 0:
    ans.pop(-1)
print("".join(ans))
= list(map(str, raw_input().split())[0])
S.sort()

flag = True
for i in range(len(S) - 1):
    if S[i] == S[i + 1]:
        flag = False
        break

if flag:
    print("yes")
else:
    print("no")

### FIXED CODE ###

S = list(map(str, raw_input().split())[0])
S.sort()

flag = True
for i in range(len(S) - 1):
    if S[i] == S[i + 1]:
        flag = False
        break

if flag:
    print("yes")
else:
    print("no")
n = int(input())
a = [list(map(int, input().split())) for i in range(n)]
for i in range(101):
    for j in range(101):
        H = []
        check = []
        for k in range(n):
            x = a[k][0]
            y = a[k][1]
            h = a[k][2]
            if h ==  0:
                check.append((x, y))
            else:
                H.append(h + abs(x-i) + abs(y-j))
                if len(set(H)) > 1:
                    break
            if k == n-1:
                state = False
                for s,t in check:
                    if H[0] - abs(s-i) - abs(t-j) > 0:
                        state = True
                        break
                if state:
                    break
                print(i, j, H[0])
                exit()



### FIXED CODE ###

n = int(input())
if n == 1:
    print("Hello World")
else:
    a = int(input())
    b = int(input())
    print(a+b)
n = int(input())
A = list(map(int,input().split())))
A.sort()
print(abs(A[0]-A[-1]))



### FIXED CODE ###

n = int(input())
A = list(map(int,input().split()))
A.sort()
print(abs(A[0]-A[-1]))
a, b = map(int, input().split())

c = a - 2b

print(c if c > 0 else 0)

### FIXED CODE ###

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

c = a - 2 * b

print(c if c > 0 else 0)
import math
a, b = map(int, input().split())
mean = (a + b) / 2.0
print(int(math.ceil(mean))


### FIXED CODE ###

import math
a, b = map(int, input().split())
mean = (a + b) / 2.0
print(math.ceil(mean))
s_list = list(input())
seizon_t = 0
s_amari = 0
for char in s_list:
  if char == "T":
    if s_amari == 0:
      seizon_t += 1:
    else:
      s_amari -= 1
  else:
    s_amari += 1
print(2*seizon_t)

### FIXED CODE ###

s_list = list(input())
seizon_t = 0
s_amari = 0
for char in s_list:
  if char == "T":
    if s_amari == 0:
      seizon_t += 1
    else:
      s_amari -= 1
  else:
    s_amari += 1
print(2*seizon_t)
# -*- coding: utf-8 -*-

n = int(input())
m = int(input())
d = int(input())

if n < d:
    print(0.00000)
    exit()

print((m-d)/n)

### FIXED CODE ###

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

s = input().split()
n = int(s[0])
m = int(s[1])
d = int(s[2])

if d==0:
    print(1.0*n*(m-1)/n/n)
else:
    print(2.0*(n-d)*(m-1)/n/n)
a,b,k = map(int, input().split())
if a==0 and b==0:
    print(0)
else:
    a = a - k
    a2 = a
    if a<0:
        a=0
    b= b + a2
    if b<0:
        b=0
	print(a,b)


### FIXED CODE ###

def solve(a,b,k):
    if a==0 and b==0:
        return '0 0'
    if a>=k:
        str = '%d %d' % (a-k,b)
        return str
    else:
        b = b + a - k
        a = 0
        if b<0:
            return '0 0'
        str = '0 %d' % (b)
        return str 
        

a,b,k = map(int, input().split())
print(solve(a,b,k))
class obj:
    def __init__(self, N):
        self.fa = [i for i in range(N)]
    def find(self, x):
        if x == self.fa[x]:
            return x
        else:
            self.fa[x] = self.find(self.fa[x])
            return self.fa[x]

N = int(input())
node = [{"x":0, "y":0, "id":i} for i in range(N)]
edge = [{"u":0, "v":0, "d":0} for i in range(2*(N-1))]
ob = obj(N)
for i in range(N):
    node[i]["x"], node[i]["y"] = map(int, input().split())
    node[i]["id"] = i

xnode = sorted(node, key=lambda x:x["x"])
for i in range(N-1):
    edge[i]["u"] = xnode[i]["id"]
    edge[i]["v"] = xnode[i+1]["id"]
    edge[i]["d"] = xnode[i+1]["x"] - xnode[i]["x"]
ynode = sorted(node, key=lambda x:x["y"])
for i in range(N-1):
    edge[i+N-1]["u"] = ynode[i]["id"]
    edge[i+N-1]["v"] = ynode[i+1]["id"]
    edge[i+N-1]["d"] = ynode[i+1]["y"] - ynode[i]["y"]
dedge = sorted(edge, key=lambda x:x["d"])
ans = 0
for i in range(2*(N-1)):
    if ob.find(dedge[i]["u"]) != ob.find(dedge[i]["v"]):
        ans += dedge[i]["d"]
        ob.fa[ob.fa[dedge[i]["u"]]] = ob.fa[dedge[i]["v"]]
print(ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(int(2e9))
class obj:
    def __init__(self, N):
        self.fa = [i for i in range(N)]
    def find(self, x):
        if x == self.fa[x]:
            return x
        else:
            self.fa[x] = self.find(self.fa[x])
            return self.fa[x]

N = int(input())
node = [{"x":0, "y":0, "id":i} for i in range(N)]
edge = [{"u":0, "v":0, "d":0} for i in range(2*(N-1))]
ob = obj(N)
for i in range(N):
    node[i]["x"], node[i]["y"] = map(int, input().split())
    node[i]["id"] = i

xnode = sorted(node, key=lambda x:x["x"])
for i in range(N-1):
    edge[i]["u"] = xnode[i]["id"]
    edge[i]["v"] = xnode[i+1]["id"]
    edge[i]["d"] = xnode[i+1]["x"] - xnode[i]["x"]
ynode = sorted(node, key=lambda x:x["y"])
for i in range(N-1):
    edge[i+N-1]["u"] = ynode[i]["id"]
    edge[i+N-1]["v"] = ynode[i+1]["id"]
    edge[i+N-1]["d"] = ynode[i+1]["y"] - ynode[i]["y"]
dedge = sorted(edge, key=lambda x:x["d"])
ans = 0
for i in range(2*(N-1)):
    if ob.find(dedge[i]["u"]) != ob.find(dedge[i]["v"]):
        ans += dedge[i]["d"]
        ob.fa[ob.fa[dedge[i]["u"]]] = ob.fa[dedge[i]["v"]]
print(ans)
n = int(input())
res= 0
if i in range(n)
    res += i+1
print(res)

### FIXED CODE ###

n = int(input())
res= 0
for i in range(n):
	res += i+1
print(res)
if S.startswith("YAKI"):
  return "Yes"
else:
  return "No"

### FIXED CODE ###

name = input()
if name.startswith("YAKI"):
  print("Yes")
else:
  print("No")
a, b = list(map, input().split())
print(a * b)

### FIXED CODE ###

a, b = list(map(int, input().split()))
print(a * b)
import numpy as np
S = input()
T = input()
s = []
t = []
i = 0
for i in range(len(S)):
    s.append(ord(S[i]))
    i += 1
i = 0
for i in range(len(T)):
    t.append(ord(T[i]))
    i += 1
    
s = np.array(s)
t = np.array(t)
print(len(S) - np.count_nonzero(s == t))

### FIXED CODE ###

a = input()
print(str(int(a) + int(a)**2 + int(a)**3))
from heapq import heappush, heappop
from enum import Enum, auto

INFTY = float('inf')

class Color(Enum):
    WHITE = auto()
    GRAY = auto()
    BLACK = auto()

n = int(input())
M = [[-1 for i in range(n)] for i in range(n)]
adj_list = []
for i in range(n):
    u, k, *kv = list(map(int, input().split(' ')))
    if k == 0: continue
    adj_list.append(kv)
    for j in range(0,2*k,2):
        M[i][kv[j]] = kv[j+1]
colors = []
d = []

def dijkstra(s):
    global d
    colors = [Color.WHITE for i in range(n)]
    d = [INFTY for i in range(n)]
    pque = []
    d[0] = 0

    heappush(pque, (0, s))

    while len(pque) >= 1:
        vert_u = heappop(pque)
        u = vert_u[1]
        colors[u] = Color.BLACK
        if d[u] < vert_u[0]: continue
        i = 0
        while i <= len(adj_list[u])-2:
            v = adj_list[u][i]
            if colors[v] != Color.BLACK:
                if d[u] + adj_list[u][i+1] < d[v]:
                    d[v] = d[u] + adj_list[u][i+1]
                    colors[v] = Color.GRAY
                    heappush(pque, (d[v], v))
            i += 2

dijkstra(0)
for i in range(n):
    print(i, d[i])



### FIXED CODE ###

from heapq import heappush, heappop
from enum import Enum, auto

INFTY = float('inf')

class Color(Enum):
    WHITE = auto()
    GRAY = auto()
    BLACK = auto()

n = int(input())
adj_list = []
for i in range(n):
    u, k, *kv = list(map(int, input().split(' ')))
    adj_list.append(kv)

colors = []
d = []

def dijkstra(s):
    global d
    colors = [Color.WHITE for i in range(n)]
    d = [INFTY for i in range(n)]
    pque = []
    d[s] = 0

    heappush(pque, (0, s))

    while len(pque) >= 1:
        vert_u = heappop(pque)
        u = vert_u[1]
        colors[u] = Color.BLACK
        if d[u] < vert_u[0]: continue
        i = 0
        while i <= len(adj_list[u])-2:
            v = adj_list[u][i]
            if colors[v] != Color.BLACK:
                if d[u] + adj_list[u][i+1] < d[v]:
                    d[v] = d[u] + adj_list[u][i+1]
                    colors[v] = Color.GRAY
                    heappush(pque, (d[v], v))
            i += 2

dijkstra(0)
for i in range(n):
    print(i, d[i])
# coding: utf-8
n, k = map(int, input().split())
h = list(map(int, input().split()))
h.sort()
if n =< k:
    print(n)
else:
    print(sum(h[0: n - k]) + k)


### FIXED CODE ###

# coding: utf-8
n, k = map(int, input().split())
h = list(map(int, input().split()))
h.sort()
if n <= k:
    print(0)
else:
    print(sum(h[0: n - k]))
S,T=input().split()
A,B=map(int,input().split())
if S==U:
  print(A-1+" "+B)

### FIXED CODE ###

S,T=input().split()
A,B=map(int,input().split())
U=input()
if U==S:
  print(str(A-1),str(B))
else:
  print(str(A),str(B-1))
n, l = map(int, input().split())

apples = [l+i for i in range(n)] #りんごの味
ans = sum(apples) - apples[apples.index(min(apples, key=abs))] #りんごの味の合計ーりんごの味の絶対値の最小
print(ans)


### FIXED CODE ###

s = input()
ans = 0
for i in range(3):
    if s[i] == s[i + 1]:
        ans = 1
        break

print('Good' if ans == 0 else 'Bad')
N, A, B = [int(input()) for i in range(3)]
 
ans = 0
for i in range(0, N+1):
    tmp=i
    sum=0
    while(tmp>0):
        sum += tmp%10
        tmp = int(tmp/10)

    if A<=sum and sum<=B:
        ans+=i
 
print(ans)

### FIXED CODE ###

N, A, B = map(int,input().split())
 
ans = 0
for i in range(0, N+1):
    tmp=i
    sum=0
    while(tmp>0):
        sum += tmp%10
        tmp = int(tmp/10)

    if A<=sum and sum<=B:
        ans+=i
 
print(ans)
n=int(input())
a=list(map(int,input().split()))
c=0
for i in range(1,len(a)+1,2):
  if a[i]%2==1:
    c+=1
print(c)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
c=0
for i in range(0,len(a),2):
  if a[i]%2==1:
    c+=1
print(c)
#????????§??\????????\??????????????????
list1 = [int(i) for i in input().split()]
print("{0} {1}",.format(list1[0]+list[1],list1[0]*list1[1])

### FIXED CODE ###

item = [int(i) for i in input().split()]
print(item[0]*item[1],2*(item[0]+item[1]))
x = input()
orint(int(x)**3)


### FIXED CODE ###

x = input('')
y = int(x)**3
print(y)
li = list(map(int,input().split()))
x = int(li[0])
y = int(li[2])

if li[1] = "+" print(x+y) else print(x-y)

### FIXED CODE ###

li = input().split()
x = int(li[0])
y = int(li[2])
print(x+y) if li[1]=="+" else print(x-y)
# coding: utf-8

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

l,p = [1],[1]
for i in range(n):
    l.append(a[i]*2+3)
    p.append(a[i]*2+1)

def f(n,x):
    if n == 0:
        return 0 if x <= 0 else 1
    elif x <= 1 + a[n-1]:
        return f(n-1,x-1)
    else:
        return p[n-1]+1+f(n-1,x-2-a[n-1])

print(f(n,x))


### FIXED CODE ###

# coding: utf-8

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

l,p = [1],[1]
for i in range(n):
    l.append(l[i]*2+3)
    p.append(p[i]*2+1)

def f(n,x):
    if n == 0:
        return 0 if x <= 0 else 1
    elif x <= 1 + l[n-1]:
        return f(n-1,x-1)
    else:
        return p[n-1]+1+f(n-1,x-2-l[n-1])

print(f(n,x))
import gcd from math
n = int(input())

ans = 0
if n == 1:
    ans = 1
else:
    for i in range(n):
        i = i + 1
        for j in range(n):
            j = j + 1
            for k in range(n):
                k = k + 1
                ij = gcd(i,j)
                ans = ans + gcd(ij,k)

print(ans)


### FIXED CODE ###

n = int(input())

def gcd(a,b):
    while b:
        a, b = b, a % b
    return a

ans = 0
if n == 1:
    ans = 1
else:
    for i in range(n):
        i = i + 1
        for j in range(n):
            j = j + 1
            for k in range(n):
                k = k + 1
                ij = gcd(i,j)
                ans = ans + gcd(ij,k)

print(ans)
sum = 0
while true:
   x = raw.input()
   sum = sum + 1
   if x == 0:
      break
for i in range(0,sum):
   print 'Case %s: %s' %(i, x)

### FIXED CODE ###

sum = 0
while 1:
   x = raw_input()
   sum = sum + 1
   if x == '0':
      break
   print 'Case %s: %s' %(sum, x)
n=int(input())
s=[list(input()) for _ in range(n)]
t=list(set(s))
print(len(t))


### FIXED CODE ###

n=int(input())
s=[input() for _ in range(n)]
t=list(set(s))
print(len(t))