Harryxun/stf_run huggingface dataset:
A, B, C, D, E, limit = map(int, input().rstrip("\n").split())

target_rate = E * 100 / (100 + E)
water_vars = {(i * A + j * B) * 100 for i in range(limit // (100 * A) + 1) for j in range(limit // (100 * B) + 1) if (i * A + j * B) * 100 <= limit}
water_vars = sorted(water_vars)
ans_solution = 0
ans_sugar = 0
min_rate_dest = 100

for water in water_vars:
    sugar_limit = limit - water
    sugar_vars = {i * C + j * D for i in range(sugar_limit // C + 1) for j in range(sugar_limit // D + 1) if i * C + j * D <= sugar_limit}
    sugar_vars = sorted(sugar_vars)
    for sugar in sugar_vars:
        rate = sugar * 100 / (sugar + water)
        if target_rate - rate == 0:
            ans_solution = water + sugar
            ans_sugar = sugar
            break
        elif 0 < target_rate - rate < min_rate_dest:
            ans_solution = water + sugar
            ans_sugar = sugar
            min_rate_dest = target_rate - rate
        else:
            break

print(ans_solution, ans_sugar)


### FIXED CODE ###

A, B, C, D, E, limit = map(int, input().rstrip("\n").split())

target_concent = E * 100 / (100 + E)
water_vars = {(i * A + j * B) * 100 for i in range(limit // (100 * A) + 1) for j in range(limit // (100 * B) + 1) if (i * A + j * B) * 100 <= limit}
water_vars = sorted(water_vars)[1:]

ans_solution = 0
ans_sugar = 0
max_concent = 0

break_all = False

for water in water_vars:
    sugar_limit = limit - water
    sugar_vars = {i * C + j * D for i in range(sugar_limit // C + 1) for j in range(sugar_limit // D + 1) if i * C + j * D <= sugar_limit}
    sugar_vars = sorted(sugar_vars)
    for sugar in sugar_vars:
        concent = sugar * 100 / (sugar + water)
        if concent == target_concent:
            ans_solution = water + sugar
            ans_sugar = sugar
            break_all = True
            break
        elif max_concent <= concent < target_concent:
            ans_solution = water + sugar
            ans_sugar = sugar
            max_concent = concent
        elif concent > target_concent:
            break
    if break_all:
        break

print(ans_solution, ans_sugar)
N=int(input())
A=[int(i) for i in input().split()]

A.sort(reverse=True)

x=0
y=0
for i in range(N):
      if A[0]==A[1]:
          x=A[0]
          A.remove(x)
          A.remove(x)
          break
      else:
          A.remove(A[0])

for i in range(len(A)):
    if A[0]==A[1]:
        y=A[0]
        break
    else:
        A.remove(A[0])

print(x*y)

### FIXED CODE ###

N=int(input())
A=[int(i) for i in input().split()]

A.sort(reverse=True)

x=0
y=0
for i in range(N-1):
      if A[0]==A[1]:
          x=A[0]
          A.remove(x)
          A.remove(x)
          break
      else:
          A.remove(A[0])
if len(A)>=2:
    for i in range(len(A)-1):
        if A[0]==A[1]:
            y=A[0]
            break
        else:
            A.remove(A[0])

print(x*y)
a,b = map(int,input().split())
if (a+b)% == 1:
  print ((a+b+1)/2)
else:
  print((a+b)/2)

### FIXED CODE ###

a,b = map(int,input().split())
if (a+b)%2 == 1:
  print (int((a+b+1)/2))
else:
  print(int((a+b)/2))
n, k = input()

print(k*(k-1)**(n-1))

### FIXED CODE ###

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

ans = k*(k-1)**(n-1)
print(ans)
from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush,heappop
import math
from collections import *
#from functools import reduce,cmp_to_key,lru_cache
import io, os
input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
import sys
# input = sys.stdin.readline



M = mod = 10**9 + 7 
def factors(n):return sorted(set(reduce(list.__add__, ([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0))))
def inv_mod(n):return pow(n, mod - 2, mod)
 
def li():return [int(i) for i in input().rstrip().split()]
def st():return str(input().rstrip())[2:-1]
def val():return int(input().rstrip())
def li2():return [str(i)[2:-1] for i in input().rstrip().split()]
def li3():return [int(i) for i in st()]
 



# sys.setrecursionlimit(10 ** 5 + 10)

g = 0
d = {}
def dp(i, par = -1, black = 0):
    global g
    ans = 1
    if (i, par, black) in d:return d[(i, par, black)]
    nokids = 1
    if black:
        for j in g[i]:
            if j != par:
                nokids = 0
                ans = ans * dp(j, i, 0) % mod
    else:
        for j in g[i]:
            if j != par:
                nokids = 0
                ans = ( ans * (dp(j, i, 0) + dp(j, i, 1)) ) % mod

    if nokids:ans = 1
    d[(i, par, black)] = ans
    return ans



n = val()
g = defaultdict(set)

l = []
for _ in range(n - 1):
    a, b = li()
    g[a].add(b)
    g[b].add(a)


root = 1    
ans = dp(root, -1, 0) + dp(root, -1, 1)

print(ans % mod)

### FIXED CODE ###

from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush,heappop
import math
from collections import *
from functools import reduce,cmp_to_key
import sys
input = sys.stdin.readline

M = mod = 10**9 +7
def factors(n):return sorted(set(reduce(list.__add__, ([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0))))
def inv_mod(n):return pow(n, mod - 2, mod)

def li():return [int(i) for i in input().rstrip('\n').split()]
def st():return input().rstrip('\n')
def val():return int(input().rstrip('\n'))
def li2():return [i for i in input().rstrip('\n')]
def li3():return [int(i) for i in input().rstrip('\n')]
def li4():return [float(i) for i in input().rstrip('\n').split(' ')]








n = val()
l = li() + [2,2]

if n == 1:
    print(0)
    exit()
elif n == 2:
    print(abs(l[0] - l[1]))
    exit()
ans = [float('inf')]*(n + 2)
ans[0] = 0
for i in range(n):
    ans[i + 1] = min(ans[i + 1],ans[i] + abs(l[i] - l[i+1]))
    ans[i + 2] = min(ans[i + 2],ans[i] + abs(l[i] - l[i+2]))
print(ans[n-1])
#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline
import numpy as np

def main():
    numbers=[]
    a,b,k = map(int,input().split())
    numbers=np.arange(a,b+1)
    A=numbers[:k]
    B=numbers[-k:]
    A = set(A)
    B = set(B)
    answers = A|B
    print(*answers,sep='\n')

if __name__=="__main__":
    main()

### FIXED CODE ###

#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline
import numpy as np

def main2():
    A,B,K=map(int,input().split())
    if A+K-1>=B-K+1:
        for i in range(A,B+1):
            print(i)
    else:
        for i in range(A,A+K):
            print(i)
        for i in range(B-K+1,B+1):
            print(i)

def main():
    numbers=[]
    a,b,k = map(int,input().split())
    numbers=np.arange(a,b+1)
    A=set(numbers[:k])
    B=set(numbers[-k:])
    answers = A|B
    
    for i in sorted(answers):
        print(i)

if __name__=="__main__":
    main2()
N,A,B,C,D = map(int,input().split())
if N > 30 and D > 1:
	flag = 10 **9
else:
	flag = pow(D,N -1)
B -= A
if N % 2 == 1:
	if (B % (C + D) <= (N - 1) * (D - C) / 2 or abs(B % (C + D) - (C + D)) <= (N - 1) * (D - C) / 2) and B <= flag and B >= -flag:
		print("YES")
	else:
		print("NO")
else:
	if ((B - (D + C) / 2) % (C + D) <= (N - 1) * (D - C) / 2 : #and B <= flag and B >= -flagor (B + (D + C) / 2) % (C + D) <= (N - 1) *  (D - C) / 2)
		print("YES")
	else:
		print("NO")

### FIXED CODE ###

N,A,B,C,D = map(int,input().split())
flag = D * (N - 1)
B -= A
if D - C == 0:
	if A == B:
		print("YES")
	else:
		print("NO")
elif N % 2 == 1:
	if (B % (C + D) <= (N - 1) * (D - C) / 2 or abs(B % (C + D) - (C + D)) <= (N - 1) * (D - C) / 2) and B <= flag and B >= -flag:
		print("YES")
	else:
		print("NO")
else:
	if abs(B % (C + D) - (D + C) / 2) <= (N - 1) * (D - C) / 2 and B <= flag and B >= -flag:
		print("YES")
	else:
		print("NO")
S = imput()

if S is 'ARC':
  print('ABC')
else:
  print('ARC')

### FIXED CODE ###

S = input()
if S == 'ABC':
  print('ARC')
else:
  print('ABC')
N,K=map(int,input().split())
arr=[]
ans=[str(i) for  i in range(1,N+1)]
for i in range(K):
    _=input()
    arr.extend((input().split()))
    arr=list(set(arr))
p=0
for n  in  ans:
    if(!(n in arr) ) :
        p=p+1
print(p)




### FIXED CODE ###

N,K=map(int,input().split())
arr=[]
ans=[str(i) for  i in range(1,N+1)]
for i in range(K):
    _=input()
    arr.extend((input().split()))
    arr=list(set(arr))
p=0
for n  in  ans:
    if(not(n in arr) ) :
        p=p+1
print(p)
print("Even" if (int(input())*int(input()))%2==0 else "Odd")

### FIXED CODE ###

a,b=map(int,input().split())
print("Even" if (a*b)%2==0 else "Odd")
a, b = map(int, input().split())
cnt = 1
sum_a = a
if a == b:
  print(1)
  return 0
while(1):
  if sum_a >= b:
    break
  sum_a = sum_a + a - 1
  cnt += 1
print(cnt)

### FIXED CODE ###

a, b = map(int, input().split())
cnt = 0
sum_a = 1
while(sum_a < b):
  sum_a += (a - 1)
  cnt += 1
print(cnt)
L, R = map(int, input().split())

mini = (L * R) % 2019

if R - l >= 2019:
    print(0)
    exit()

for i in range(L % 2019, R % 2019):
    for j in range(i + 1, R % 2019 + 1):
        mini = min(mini, (i * j) % 2019)



print(mini)

### FIXED CODE ###


L, R = map(int, input().split())

mini = (L * R) % 2019

if R - L >= 2019:
    print(0)
    exit()

for i in range(L % 2019, R % 2019):
    for j in range(i + 1, R % 2019 + 1):
        mini = min(mini, (i * j) % 2019)



print(mini)
MOD = 1e9 + 7
p3 = [1]

S = input()
n = len(S)

a = []
c = []
q = []
for i in range(n):
  p3.append(int(p3[i] * 3))
  if S[i] == 'A':
    a.append(1)
  else:
    a.append(0)
  if S[i] == 'C':
    c.append(1)
  else:
    c.append(0)
  if S[i] == '?':
    q.append(1)
  else:
    q.append(0)

for i in range(1, n):
  a[i] += a[i - 1]
  c[i] += c[i - 1]
  q[i] += q[i - 1]

count = 0
for i in range(1, n - 1):
  if S[i] == 'B' or S[i] == '?':
    bq = 0 if S[i] == 'B' else 1
    count += a[i - 1] * (c[n - 1] - c[i]) * p3[q[n - 1] - bq]
    count %= MOD
    count += q[i - 1] * (c[n - 1] - c[i]) * p3[q[n - 1] - 1 - bq]
    count %= MOD
    count += a[i - 1] * (q[n - 1] - q[i]) * p3[q[n - 1] - 1 - bq]
    count %= MOD
    count += q[i - 1] * (q[n - 1] - q[i]) * p3[q[n - 1] - 2 - bq]
    count %= MOD
    

print(int(count))

### FIXED CODE ###

MOD = 10**9 + 7
p3 = [1]

S = input()
n = len(S)

a = []
c = []
q = []
for i in range(n):
  p3.append(int(p3[i] * 3 % MOD))
  if S[i] == 'A':
    a.append(1)
  else:
    a.append(0)
  if S[i] == 'C':
    c.append(1)
  else:
    c.append(0)
  if S[i] == '?':
    q.append(1)
  else:
    q.append(0)

for i in range(1, n):
  a[i] += a[i - 1]
  c[i] += c[i - 1]
  q[i] += q[i - 1]

count = 0
for i in range(1, n - 1):
  if S[i] == 'B' or S[i] == '?':
    bq = 0 if S[i] == 'B' else 1
    count += a[i - 1] * (c[n - 1] - c[i]) * p3[q[n - 1] - bq]
    count += q[i - 1] * (c[n - 1] - c[i]) * p3[q[n - 1] - 1 - bq]
    count += a[i - 1] * (q[n - 1] - q[i]) * p3[q[n - 1] - 1 - bq]
    count += q[i - 1] * (q[n - 1] - q[i]) * p3[q[n - 1] - 2 - bq]

print(int(count % MOD))
n = int(input())
hs = list(map(int, input().split()))

def solve(array):
    if len(array) < 2:
        return 0
    elif len(array) == 2:
        return abs(array[0]-array[1])
    else:
        cost1 = solve(array[1:]) + abs(array[0]-array[1])
        cost2 = solve(array[2:]) + abs(array[0]-array[2])
        return min(cost1, cost2)

cost = solve(hs)
print(cost)



### FIXED CODE ###

n = int(input())
hs = list(map(int, input().split()))
dp = [0]*n

# cost1 = dp[i-1] + abs(dp[i-1]-dp[i])
# cost2 = dp[i-2] + abs(dp[i-2]-dp[i])
# dp[i] = min(cost1, cost2)

#for i in reversed(range(n)):
for i in range(n):
    if i == 0:
        dp[0] = 0
    elif i == 1:
        dp[1] = abs(hs[0]-hs[1])
    else:
        cost1 = dp[i-1] + abs(hs[i-1]-hs[i])
        cost2 = dp[i-2] + abs(hs[i-2]-hs[i])
        dp[i] = min(cost1, cost2)

print(dp[n-1])
n = input()
    R = []

    for i in range(1,n):
        R.append(input())
 
    max = R[1] - R[0]
    min = R[0]
 
    for i in range(2,n):
        if R[i]-min>max:
            max = R[i] - min
        if R[i]<min:
            min = R[i]
 
    print max

### FIXED CODE ###

n = input()

R = [input() for i in range(n)]
  
max = R[1] - R[0]
min = R[0]
  
for i in range(1,n):
    if R[i] - min > max:
        max = R[i] - min
    if R[i] < min:
        min = R[i]
  
print max
# coding: utf-8
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, K = lr()
P = np.array(lr(), np.float32)
P += 1; P /= 2
P = [0] + P
print(P)
Pcum = P.cumsum()
expectation = Pcum[K:] - Pcum[:-K]
answer = expectation.max()
print(answer)


### FIXED CODE ###

import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, K = lr()
P = np.array([0] + lr())
P = (P+1) / 2
Pcum = P.cumsum()
X = Pcum[K:] - Pcum[:-K]
answer = X.max()
print(answer)
from collections import deque

N = int(input())
t = [0] * N
x = [0] * N
y = [0] * N

for i in range(N):
    t[i], x[i], y[i] = map(int, input().split())

N += 1
t.appendleft(0)
x.appendleft(0)
y.appendleft(0)

for i in range(N):
    t_sub = t[i+1] - t[i]
    x_sub = abs(x[i+1] - x[i])
    y_sub = abs(y[i+1] - y[i])
    dist = x_sub + y_sub
    if dist > t_sub or t_sub % 2 == dist % 2:
        print('No')
        exit()

print('Yes')

### FIXED CODE ###

from collections import deque

N = int(input())
t = deque([0] * N)
x = deque([0] * N)
y = deque([0] * N)

for i in range(N):
    t[i], x[i], y[i] = map(int, input().split())

N += 1
t.appendleft(0)
x.appendleft(0)
y.appendleft(0)

for i in range(N-1):
    t_sub = t[i+1] - t[i]
    x_sub = abs(x[i+1] - x[i])
    y_sub = abs(y[i+1] - y[i])
    dist = x_sub + y_sub
    if dist > t_sub or t_sub % 2 != dist % 2:
        print('No')
        exit()

print('Yes')
a,b,c = [int(x) for x input().split( )]
if a<b<c:
    print('Yes')
else:
    print('No')



### FIXED CODE ###

a,b,c = [int(x) for x in input().split( )]
if a<b<c:
    print('Yes')
else:
    print('No')
import math
a, b, x = map(int, input().split())
if a * b <= x / a:
  print(math.degrees(math.atan((2 * x / a / a/ a)))
else:
  print(90 - math.degrees(math.atan(x / (0.5 *(b*b)*a))))
  

### FIXED CODE ###

import math
a, b, x = map(int, input().split())
A = math.degrees(math.atan((2*(a*a*b - x) / a/a/a)))
B = 90 - math.degrees(math.atan(x / (0.5 *(b*b)*a)))
if a * math.tan(math.radians(A)) < b:
  print(math.degrees(math.atan((2*(a*a*b - x) / a/a/a))))
else:
  print(90 - math.degrees(math.atan(x / (0.5 *(b*b)*a))))
a, b = map(int, imput().split())
seki = a*b
if seki % 2 == 0;
	print('Even')
else:
	print('Odd')

### FIXED CODE ###

a, b = map(int, input().split())
if (a*b) % 2:
    print("Odd")
else:
    print("Even")
A,B = map(int,input().split())
if A == B :
    print "Yes"
else :
    print "No"
  

### FIXED CODE ###

A,B = map(int,input().split())
if A == B :
    print ("Yes")
else :
    print ("No")
n = int(input())
s = input()
c = 0
if n <= 2:
  print(0)
else:
  for i in range(2,n+1):
    if s[i-2] == "A" and s[i-1] == "B" and s[i] == "C":
      c += 1
  print(c)

### FIXED CODE ###

n = int(input())
s = input()
c = 0
for i in range(2,n):
  if s[i-2] == "A" and s[i-1] == "B" and s[i] == "C":
    c += 1
print(c)
import math

N = int(input())
h = list(map(int, input().split()))
dp = [float('INF')] * N
INF = float('INF')
def chmin(a, b):
    if a >= b:
        return b
    else:
        return a

def DFS(i):
    if dp[i] < INF:
        return dp[i]
    
    if (i == 0):
        dp[i] = 0
        return 0
    
    res = INF
    res = chmin(INF, DFS(i-1) + abs(h[i] - h[i-1]))
    dp[i] = res
    if i > 1:
        res = chmin(res, DFS(i-2) + abs(h[i] - h[i-2]))
        dp[i] = res
    
    return res
print(DFS(N-1))

### FIXED CODE ###

import math

N = int(input())
h = list(map(int, input().split()))
dp = [float('INF')] * N

def chmin(a, b):
    if a >= b:
        return b
    else:
        return a

#初期値
dp[0] = 0

#Loop
for i in range(1, N):
    dp[i] = chmin(dp[i], dp[i-1] + abs(h[i] - h[i-1]))
    if i > 1:
        dp[i] = chmin(dp[i], dp[i-2] + abs(h[i] - h[i-2]))
print(dp[-1])
if __name__ == '__main__':
    N = int(input())
    if N-90>0:
        i = 1
    x = (N-9)/10
    if x == int(x):
        i = 1
    if i == 1:
        print(Yes)
    else:
        print(No)

### FIXED CODE ###

if __name__ == '__main__':
    i = 0
    N = int(input())
    if N-90>0:
        i = 1
    x = (N-9)/10
    if x == int(x):
        i = 1
    if i == 1:
        print('Yes')
    else:
        print('No')
input = sys.stdin.readline
N, Q = map(int, input().split())

S = [None] * N
T = [None] * N
X = [None] * N
for i in range(N):
    S[i], T[i], X[i] = map(int, input().split())

D = [None] * Q
for i in range(Q):
    D[i] = int(input())
    
# X S T
roadworks = [(x, s, t) for x, s, t in zip(X, S, T)]
roadworks = sorted(roadworks, key=lambda x: x[0])
#print(roadworks)

# Dは入力時点でソート済み
walkers = D[:]
ans = [-1] * Q
skip = [-1] * Q

import bisect
for x, s, t in roadworks:
    left = bisect.bisect_left(walkers, s - x)
    right = bisect.bisect_left(walkers, t - x)
    
    i = left
    while i < right:
        if skip[i] == -1:
            ans[i] = x
            skip[i] = right
            i += 1
        else:
            i = skip[i]

    
#print(walkers)
for a in ans:
    print(a)
    




    
    


### FIXED CODE ###

import sys
input = sys.stdin.readline
N, Q = map(int, input().split())

S = [None] * N
T = [None] * N
X = [None] * N
for i in range(N):
    S[i], T[i], X[i] = map(int, input().split())

D = [None] * Q
for i in range(Q):
    D[i] = int(input())
    
# X S T
roadworks = [(x, s, t) for x, s, t in zip(X, S, T)]
roadworks = sorted(roadworks, key=lambda x: x[0])
#print(roadworks)

# Dは入力時点でソート済み
walkers = D[:]
ans = [-1] * Q
skip = [-1] * Q

import bisect
for x, s, t in roadworks:
    left = bisect.bisect_left(walkers, s - x)
    right = bisect.bisect_left(walkers, t - x)
    
    i = left
    while i < right:
        if skip[i] == -1:
            ans[i] = x
            skip[i] = right
            i += 1
        else:
            i = skip[i]

    
#print(walkers)
for a in ans:
    print(a)
N, X, Y = map(int, input().split())

g = [[]  for i in range(N)]
for i in range(N):
    u = i
    v = i + 1
    if v < 5:
        g[u].append(v)
        g[v].append(u)

g[X - 1].append(Y - 1)
g[Y - 1].append(X - 1)

from collections import deque
dis = [[float('Inf')] * N for _ in range(N)]
count = [0] * (N - 1)
def bfs(i):
    d = [False] * N
    que = deque()
    #for j in g[i]:
    que.append(i)
    d[i] = True
    dis[i][i] = 0
    pre = i
    while que:
        p = que.popleft()

        for k in g[p]:
            if d[k]:
                continue
            else:
                d[k] = True
                que.append(k)
                dis[i][k] = dis[i][p] + 1
                dis[k][i] = dis[i][p] + 1
                count[dis[i][k] - 1] += 1 
                #count[dis[k][i] - 1] += 1
        pre = p

for i in range(N):
    bfs(i)

for i in range(N - 1):
    print(count[i] // 2)

### FIXED CODE ###

N, X, Y = map(int, input().split())

g = [[]  for i in range(N)]
for i in range(N):
    u = i
    v = i + 1
    if v < N:
        g[u].append(v)
        g[v].append(u)

g[X - 1].append(Y - 1)
g[Y - 1].append(X - 1)

from collections import deque
dis = [[float('Inf')] * N for _ in range(N)]
count = [0] * (N - 1)
def bfs(i):
    d = [False] * N
    que = deque()
    #for j in g[i]:
    que.append(i)
    d[i] = True
    dis[i][i] = 0
    pre = i
    while que:
        p = que.popleft()

        for k in g[p]:
            if d[k]:
                continue
            else:
                d[k] = True
                que.append(k)
                dis[i][k] = dis[i][p] + 1
                dis[k][i] = dis[i][p] + 1
                count[dis[i][k] - 1] += 1 
                #count[dis[k][i] - 1] += 1
        pre = p

for i in range(N):
    bfs(i)

for i in range(N - 1):
    print(count[i] // 2)
N, M = map(int, input().split())
a = list(map(int, input().split()))
for i in range(M):
    B, C = map(int, input().split())
    if C > a[-1]:
        a += [C for _ in range(B)]
        a.sort(reverse=True)
        a = a[:N]
print(sum(a))

### FIXED CODE ###

A, B = map(int, input().split())
if A >= 13:
    print(B)
elif 6 <= A < 13:
    print(B//2)
else:
    print(0)
n = int(input()) 

if(is_prime(n)):
    print(n)
else:
    while(is_prime(n) == False):
        n = n + 1;
        is_prime(n)
    print(n)
        
    

### FIXED CODE ###

n = int(input()) 

import math
def is_prime(n):
    if n == 1: return True

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False
    return True

if(is_prime(n)):
    print(n)
else:
    while(is_prime(n) == False):
        n = n + 1
        is_prime(n)
    print(n)
a = list(input())
b = list(input())
c = list(input())
key = "a"
for i in range(300):
  if key = "a":
    if len(a) == 0:
      print("A")
      break
    else:
      key = a[0]
      a = a[1:]
      
  elif key = "b":
    if len(b) == 0:
      print("B")
      break
    else:
      key = b[0]
      b = b[1:]
      
  else:
    if len(c) == 0:
      print("C")
      break
    else:
      key = c[0]
      c = c[1:]
    
      

### FIXED CODE ###

a = list(input())
b = list(input())
c = list(input())
key = "a"
for i in range(300):
  if key == "a":
    if len(a) == 0:
      print("A")
      break
    else:
      key = a[0]
      a = a[1:]
      
  elif key == "b":
    if len(b) == 0:
      print("B")
      break
    else:
      key = b[0]
      b = b[1:]
      
  else:
    if len(c) == 0:
      print("C")
      break
    else:
      key = c[0]
      c = c[1:]
S = input()
day_list = ["MON", "TUE", "WED", "THU", "FRI", "SAT"]
if S == "SUN":
  print(7)
else:
  ind = day_list.index(S)
  printt(6-ind)

### FIXED CODE ###

S = input()
day_list = ["MON", "TUE", "WED", "THU", "FRI", "SAT"]
if S == "SUN":
  print(7)
else:
  ind = day_list.index(S)
  print(6-ind)
A,B=map(int,input().split)

print(A*B)

### FIXED CODE ###

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

print(A*B)
n=int(input())
p=list(map(int,input().split()))
cnt=0
for i in range(n):
    if p[i]==i+1:
        cnt+=1
        x=1
        if i==n:
            break
        while True:
            if p[i+x]!=i+1:
                temp_v=p[i+x]
                p[i+x]=p[i]
                p[i]=temp_v
                break
            else:
                x+=1
print(cnt)

### FIXED CODE ###

n=int(input())
p=list(map(int,input().split()))
cnt=0
for i in range(n):
    if p[i]==i+1:
        cnt+=1
        x=1
        if i==n-1:
            break
        while True:
            if p[i+x]!=i+1:
                temp_v=p[i+x]
                p[i+x]=p[i]
                p[i]=temp_v
                break
            else:
                x+=1
print(cnt)