Harryxun/stf_run huggingface dataset:
n = int(input())
a = list(map(int,input().split()))
cnt = 0

def ers(a,cnt):
    if len(a) == 0:
        cnt = -1
        return cnt
    for i in range(len(a)):
        if i+1 != a[i]:
            a.pop(i)
            cnt+=1
            return ers(a,cnt)
    return cnt

res = ers(a,cnt)

print(res)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
cnt = 0
for i in range(N):
    if A[i] != i+1-cnt:
        cnt += 1
if cnt == N:
    print(-1)
else:
    print(cnt)
n = int(input())
a = list(map(int,input().split()))
ball = [0 for i in range(n)]
count = 0 #ボールが入ってる箱の数
index = [] #ボールが入ってる番号

for i in range(n-1, -1, -1):
    balls = 0
    j = i
    while j < n:
        j += i + 1
        balls += ball[j]
    
    if a[i] != balls%2:
        a[i] = 1
        count += 1
        index.append(i+1)
        
ans = ""
for i in range(len(index)):
    if i < len(index)-1:
        ans += str(index[i]) + " "
    else:
        ans += str(index[i])
print(count)
print(ans)

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
ball = [0 for i in range(n)]
count = 0 #ボールが入ってる箱の数
index = [] #ボールが入ってる番号

for i in range(n-1, -1, -1):
    balls = 0
    j = i
    while j +(i+1) < n:
        j += i + 1
        balls += ball[j]
    
    if a[i] != balls%2:
        ball[i] = 1
        count += 1
        index.append(i+1)
        
ans = ""
for i in range(len(index)):
    if i < len(index)-1:
        ans += str(index[i]) + " "
    else:
        ans += str(index[i])
print(count)
print(ans)
N, M, X =map(int,input().split())
A = list(map(int,input().split()))

t= [i for i in A if i> 0 and i< X]
s= [i for i in A if i> X and i <N]

print(min(len(t),len(s)))

### FIXED CODE ###

A, B, X= map(int,input().split())
if A <= X and A + B >=X:
    print('YES')
else: 
    print('NO')
strs = []
inter1 = {}
for _ in range(n):
    strs.append(input())

for char in strs[0]:
    if char in inter1:
        inter1[char] +=1
    else:
        inter1[char] = 1
        
for i in range(1,n):
    inter2 = {}
    for char in strs[i]:
        if (char in inter1):
            if char in inter2:
                if inter2[char] < inter1[char]:
                    inter2[char] +=1
            else:
                inter2[char] =1 
    inter1 = inter2

inter = sorted(inter1.items())
ans = ''
for char,i in inter:
    for _ in range(i):
        ans +=char
print(ans)

### FIXED CODE ###

n = int(input())
strs = []
inter1 = {}
for _ in range(n):
    strs.append(input())

for char in strs[0]:
    if char in inter1:
        inter1[char] +=1
    else:
        inter1[char] = 1
        
for i in range(1,n):
    inter2 = {}
    for char in strs[i]:
        if (char in inter1):
            if char in inter2:
                if inter2[char] < inter1[char]:
                    inter2[char] +=1
            else:
                inter2[char] =1 
    inter1 = inter2

inter = sorted(inter1.items())
ans = ''
for char,i in inter:
    for _ in range(i):
        ans +=char
print(ans)
a b = input()

print a * b
print a * 2 + b * 2

### FIXED CODE ###


l = map(int, raw_input().split())
 
print "%d %d" % (l[0]*l[1], (l[0]+l[1])*2)
X, Y = map(int, input().split())
if (4*X - Y) < 0:
    print("No")
elif 6*X > Y:
    print("No")
elif (4*X - Y)%2 != 0:
    print("No")
else:
    print("Yes")

### FIXED CODE ###

A = [int(x) for x in input().split()]
num = 1
for i in A:
    if i == num:
        num += 1
    else:
        print(num)
        break
import numpy as np

def monji(a) :
    D = []
    STR = ''
    for i in range(0,len(a)) :
        for j in range(len(a[i])) :
            if a[i][j] == " " :
                D.append(int(STR))
                STR = ''
            else :
                STR = STR + a[i][j]
    return D

def kaijo(a) :
    k = 1
    for i in range(1,a+1) :
        k = k * i
    return k
  
def zyunretsu(N) :
    len_N = len(N) - 1
    c = 1
    for i in range(0,len(N)) :
        if len_N == 0 :
            break
        a = N[0]
        N_C = sorted(N)
        b = N_C.index(a)
        c = c + kaijo(len_N) * b
        N.remove(a)
        len_N = len_N - 1
    return c
  
a_1 = input()
a_2 = input()
a_3 = input()
b = monji(a_2)
c = monji(a_3)
print(abs(b-c))

### FIXED CODE ###

a = list(map(int,input().split()))
a_1 = list(map(int,input().split()))
a_2 = list(map(int,input().split()))

def kaijo(a) :
    k = 1
    for i in range(1,a+1) :
        k = k * i
    return k

def zyunretsu(N) :
    len_N = len(N) - 1
    c = 1
    for i in range(0,len(N)) :
        if len_N == 0 :
            break
        a = N[0]
        N_C = sorted(N)
        b = N_C.index(a)
        c = c + kaijo(len_N) * b
        N.remove(a)
        len_N = len_N - 1
    return c

print(abs(zyunretsu(a_1)-zyunretsu(a_2)))
s = input
if s.count("a") == 1 and s.count("b") == 1 and s.count("c") == 1:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

s = input()
if s.count("a") == 1 and s.count("b") == 1 and s.count("c") == 1:
  print("Yes")
else:
  print("No")
n, m = map(int,input().split())
a = [int(input()) for _ in range(m)]
dp = [0]*(n+2)
mod = int(1e9+7)
for i in range(n, -1, -1):
  if i==n and a[-1]!=i:
    dp[i] = 1
  elif i!=n:
    if i in a:
      dp[i] = 0
    else:
      dp[i] = dp[i+1] + dp[i+2]
  else:
    break

print(dp[0]%mod)


### FIXED CODE ###

n, m = map(int,input().split())
broken = [0]*(n+1)
for _ in range(m):
  a = int(input())
  broken[a]=1

dp = [0]*(n+2)
mod = int(1e9+7)
dp[n] = 1
for i in range(n-1, -1 , -1):
  if broken[i]:
    dp[i] = 0
  else:
    dp[i] = (dp[i+1] + dp[i+2]) % mod

print(dp[0])
def(a, b)
  c = a * b
  if(c % 2 == 0):
  	print("Even")
  else:
    print("Odd")
  

### FIXED CODE ###

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

c = a * b
if(c % 2 == 0):
  print("Even")
else:
  print("Odd")
N, A, B = map(int, input().split())
ball = []
kaisu = -(-N//(A+B))

for n in range(kaisu):
    ball += [0]*A
    ball += [1]*B

ball = ball[:N]
print(ball.count(0))

### FIXED CODE ###

N, A, B = map(int, input().split())
kaisu = N//(A+B)

n = N-((A+B)*kaisu)
if n >= A:
    print(A*(kaisu+1))
else:
    print(A*kaisu+n)
import heapq

N , M = map(int,input().split())
A = list(map(lambda x:-int(x),input().split()))

heapq.heapify(A)
for _ in range(M):
    largest = heapq.heappop(A)
    largest = -((-largest)//2)
    if largest != 0:
        heapq.heappush(A, largest)

print(-sum(A))

### FIXED CODE ###

import heapq

N , M = map(int,input().split())
A = list(map(lambda x:-int(x),input().split()))

heapq.heapify(A)
for _ in range(M):
    largest = heapq.heappop(A)
    largest = -((-largest)//2)
    heapq.heappush(A, largest)

print(-sum(A))
a,b = map(int,input().split())
s = input()

if s.count('-') == 1:
    s = s.split('-')
    if len('-'.join(s)) == a+b+1 and len(s[0])== a and len(s[2]) == b:
        print('Yes')
    else:
        print('No')
else:
    print('No')

### FIXED CODE ###

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

if s.count('-') == 1:
    S = s.split('-')
    if len('-'.join(S)) == a+b+1 and len(S[0]) == a and len(S[1]) == b:
        print('Yes')
    else:
        print('No')
else:
    print('No')
def main():
	N, K = map(int, input().split())
	h = list(map(int, input().split()))
	INF = 10**9
	dp = [INF] * N
	dp[0] = 0
	for i in range(N):
    	for k in range(1, K+1):
        	if i + k < N:
            	dp[i+k] = min(dp[i+k], dp[i]+abs(h[i] - h[i+k]))
        	else:
            	break
	print(dp[N-1])

if __name__ == '__main__':
	main()


### FIXED CODE ###

N, K = map(int, input().split())
h = list(map(int, input().split()))
INF = 10**9
dp = [INF] * N
dp[0] = 0
for i in range(N):
    for k in range(1, K+1):
        if i + k < N:
            dp[i+k] = min(dp[i+k], dp[i]+abs(h[i] - h[i+k]))
print(dp[N-1])
a,b,n=map(int,input().split())
c=[]
i=0
while(1):
  i=i+1
  if a%i==0 and b%i==0:
    c,append(i)
  if a<=i or b<=i:
    break
print(c[(len(c)-k+1)])

### FIXED CODE ###

a,b,n=map(int,input().split())
c=[]
i=0
while(1):
  i=i+1
  if a%i==0 and b%i==0:
    c.append(i)
  if a<=i or b<=i:
    break
d=len(c)-n
print(c[d])
#include<cstdio>
#include<iostream>
using namespace std;
int main()
{
	unsigned long long a,b,c,d,e,n;
	cin>>n>>a>>b;
	e=(a+b)*n/2;
	cout<<e;
	return 0;
}

### FIXED CODE ###

n, a, b = map(int, raw_input().split())
print max(a - b + (b - a) * max(n - 1, 0) + 1, 0)
from sys import stdin
s = str(stdin.readline().rstrip())
q = int(stdin.readline().rstrip())
for i in range(q):
    query = list(map(int, stdin.readline().rstrip().split()))
    if int(query[0])==1:
        s = s[::-1]
    else:
        if int(query[1])==2:
            s += query[2]
        else:
            s = query[2] + s

print(s)


### FIXED CODE ###

from sys import stdin
s = str(stdin.readline().rstrip())
#A, B, C = map(int, stdin.readline().rstrip().split())
#S = [list(map(int, stdin.readline().rstrip().split())) for _ in range(h)]#hの定義を忘れずに
q= int(stdin.readline().rstrip())
hanten = 0
t=""
u=""

for i in range(q):
    l = list(map(str, stdin.readline().rstrip().split()))
    if int(l[0]) == 1:
        t,u = u,t
        hanten ^= 1
    else:
        if int(l[1])==1:
            t+=l[2]
        else:
            u+=l[2]


if hanten==0:
    print(t[::-1]+s+u)
else:
    print(t[::-1]+s[::-1]+u)
n, m = map(int, input().split())
l=list(map(int, input().split()))
l.sort()
d=[]
for i in range(m-1):
    d.append(abs(l[i+1]-l[i]))

if(len(d)<1):
    print("0")
    exit()

for _ in range(n-1):
    d.remove(max(d))

print(sum(d))


### FIXED CODE ###

n, m = map(int, input().split())
l=list(map(int, input().split()))

if(n>=m):
    print("0")
    exit()

l.sort()
d=[]
for i in range(m-1):
    d.append(abs(l[i+1]-l[i]))

d.sort()
print(sum(d[:m-n]))
a,b=map(int,input().split())
if a>10:
    print('b')
else:
    print(b-(100＊(10-b)

### FIXED CODE ###

a,b=map(int,input().split())
if a>9:
  print(b)
else:
  print(b+(100*(10-a)))
input_number = int(input())
input_str = input()
abc_list = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
abc_list = abc_list + abc_list
for i in len(input_str):
    output_str += abc_list[abc_list.index(input_str[i]) + input_number]

### FIXED CODE ###

input_number = int(input())
input_str = input()
abc_list = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
abc_list = abc_list + abc_list
output_str = ""
for i in range(len(input_str)):
    output_str += abc_list[abc_list.index(input_str[i]) + input_number]
print(output_str)
target = input()
data = ""
while True:
    string = input()
    if(string == "END_OF_FILE"): break
    data += string

print("%d" %(data.lower().count(target.lower())))


### FIXED CODE ###

import sys
target = input()
data = sys.stdin.read()

print("%d" %(data.lower().split().count(target.lower())))
n, k = map(int, input().split())
a = list(map(lambda x: int(x) - 1, input().split()))
visited = [-1 for _ in range(n)]
visited[0] = 0
l = [0]
for i in range(k):
    nex = a[l[i]]
    if visited[nex] != -1:
        res = visited[nex]
        cyc = i + 1 - visited[nex]
        break
    else:
        l += [nex]s
        visited[nex] = i + 1
print(l[res + (k - res) % cyc] + 1 if k > res else l[k] + 1)


### FIXED CODE ###

n, k = map(int, input().split())
a = list(map(lambda x: int(x) - 1, input().split()))
visited = [-1 for _ in range(n)]
visited[0] = 0
l = [0]
for i in range(k):
    nex = a[l[i]]
    if visited[nex] != -1:
        res = visited[nex]
        cyc = i + 1 - visited[nex]
        break
    else:
        l += [nex]
        visited[nex] = i + 1
else:
    res = k + 1
print(l[res + (k - res) % cyc] + 1 if k > res else l[k] + 1)
m= int(input())
n= int(input())

print(round((n/m)+0.4))

### FIXED CODE ###

s = input().split(" ")
a = int(s[0])
b = int(s[1])
c = 1
ans = 0

while c < b:
	c += a - 1
	ans += 1

print(ans)
def partition(A,p=0, r=None):
    if r is None:
        r = len(A)-1
    x = A[r]
    i = p-1
    for j in range(p,r):
        while A[j] <= x:
            i += 1
            swap(A,i,j)
    swap(A,i+1,r)
    return i+1

k = partition(A)
B = list(map(str, A))
B[k] = "[{}]".format(B[k])
print(" ".join(B))

### FIXED CODE ###

def swap(A,i,j):
    A[i],A[j] = A[j],A[i]
    return A

def partition(A,p=0, r=None):
    if r is None:
        r = len(A)-1
    x = A[r]
    i = p-1
    for j in range(p,r):
        if A[j] <= x:
            i += 1
            swap(A,i,j)
    swap(A,i+1,r)
    return i+1

if __name__ == "__main__":
    input()
    A = list(map(int, input().strip().split()))
    k = partition(A)
    B = list(map(str, A))
    B[k] = "[{}]".format(B[k])
    print(" ".join(B))
total_stay = int(input())
normal_stay = int(input())
normal_cost = int(input())
discounted_cost = int(input())
if total_stay <= normal_stay:
  total_cost = total_stay * normal_cost
else:
  total_cost = normal_stay * normal_cost + (total_stay - normal_stay) * discounted_cost
print(P)

### FIXED CODE ###

N, K, X, Y = (int(input()) for i in range(4))
print(K * X + (N - K) * Y if N > K else N * X)
import sys
sys.setrecursionlimit(100000)

n = int(input())
s = input()
s_set = set(s)
S = []
for i in s_set:
    S.append(s.count(i))

def cal(n, S):
    if n == 1:
        return sum(S)
    ans = 0
    if n == 2:
        for i in range(len(S) - 1):
            for j in range(i+1, len(S)):
                ans += S[i] * S[j]
    else:
        for i in range(len(S) - n + 1):
            cross = cal(n-1, S[i+1:])
            cross %= 10 ** 9 + 7
            ans += S[i] * cross
            ans %= 10 ** 9 +7
        return ans % 10 ** 9 + 7

ans = 0
for i in range(n):
    ans += cal(i+1, S)

ans %= 10 ** 9 + 7
print(ans)



### FIXED CODE ###

n = int(input())
s = input()
s_set = set(s)
S = []
for i in s_set:
    S.append(s.count(i))

ans = 1
for i in S:
    ans *= i + 1
    ans %= 10 ** 9 + 7

print(ans - 1)
from collections import defaultdict
n = int(input())
d = defaultdict(int)
for i in range(1, n+1):
  s = str(i)
  d[(i[0], i[-1])]+=1
ans = 0
for i, j in d.items():
  ans+=j*d[i[::-1]]
print(ans)

### FIXED CODE ###

from collections import defaultdict
n = int(input())
d = defaultdict(int)
for i in range(1, n+1):
  s = str(i)
  d[(s[0], s[-1])]+=1
ans = 0
x = list(d.keys())
for i in x:
    ans+=d[i[::-1]]*d[i]
print(ans)
S=input()
l=len(S)
r=0
list5 = ['dream', 'erase']
list81 = ['dreamdre', 'dreamera', 'erasedre', 'eraseera']
list82 = ['dreamerd', 'dreamere']
list83 = ['eraserdr', 'eraserer']
if l<=4:
    print(NO)

while l>=5:
    if S[r:r+5] in list5:
        if r+5==l:
            print(YES)
            break
        elif r+5 == l-1:
            if S[r:r+6] == 'eraser':
                print(YES)
            else:
                print(NO)
            break
        elif r+5 == l-2:
             if S[r:r+7] == 'dreamer':
                 print(YES)
             else:
                 print(NO)
             break
        elif r+5 == l-3 or r+5 == l-4:
            print(NO)
            break
        else:
            if S[r:r+8] in list81:
                r=r+5
            elif S[r:r+8] in list82:
                r=r+7
            elif S[r:r+8] in list83:
                r=r+6
            else:
                print(NO)
                break
    else:
        print(NO)
        break

### FIXED CODE ###

S=input()
l=len(S)
r=0
list5 = ['dream', 'erase']
list81 = ['dreamdre', 'dreamera', 'erasedre', 'eraseera']
list82 = ['dreamerd', 'dreamere']
list83 = ['eraserdr', 'eraserer']
if l<=4:
    print('NO')

while l>=5:
    if S[r:r+5] in list5:
        if r+5==l:
            print('YES')
            break
        elif r+5 == l-1:
            if S[r:r+6] == 'eraser':
                print('YES')
            else:
                print('NO')
            break
        elif r+5 == l-2:
             if S[r:r+7] == 'dreamer':
                 print('YES')
             else:
                 print('NO')
             break
        elif r+5 == l-3 or r+5 == l-4:
            print('NO')
            break
        else:
            if S[r:r+8] in list81:
                r=r+5
            elif S[r:r+8] in list82:
                r=r+7
            elif S[r:r+8] in list83:
                r=r+6
            else:
                print('NO')
                break
    else:
        print('NO')
        break
import math

list_8 = []
list_10 = []

for i in range(100):
  list_8.append( math.floor((i+1) * 12.5) )
  list_10.append( (i+1) * 10 )
  
A, B = map(int, input().split())

A_ = list_8[A]
A = list_8[A-1]

B_ = list_10[B]
B = list_10[B-1]

if A_ < B or B_ < A:
  print(-1)
elif B <= A_:
  print(B)
else:
  print(A)

### FIXED CODE ###

import math

list_8 = []
list_10 = []

for i in range(101):
  list_8.append( math.ceil((i+1) * 12.5) )
  list_10.append( (i+1) * 10 )
  
A, B = map(int, input().split())

A_ = list_8[A] - 1
A = list_8[A-1]
  
B_ = list_10[B] - 1
B = list_10[B-1]

if A <= B <= A_:
  print(B)
elif B <= A <= B_:
  print(A)
else:
  print(-1)
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...)
#endif

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> p(n), x(n);
    for (int i = 1; i < n; i++) {
        cin >> p[i];
        p[i]--;
    }
    for (int i = 0; i < n; i++) {
        cin >> x[i];
    }
    bool ok = false;

    if (ok) {
        puts("POSSIBLE");
    } else {
        puts("IMPOSSIBLE");
    }
    return 0;
}

### FIXED CODE ###

n = int(input())
h = list(map(int, input().split()))
mn = 0
ans = "Yes"
for i in h:
    if i <= mn - 2:
        ans = "No"
    else:
        mn = max(mn, i)
print(ans)
A,B,C,D=list(map(int,input().split()))
print(min(A,B) + min(C,D))

### FIXED CODE ###

A = int(input())
B = int(input())
C = int(input())
D = int(input())
print(min(A,B) + min(C,D))
import collections
def main():
    n = int(input())
    v = list(map(int,input().split()))

    odd = v[1::2]
    count_e = collections.Counter(even)
    count_o = collections.Counter(odd)
    ce = count_e.most_common()
    co = count_o.most_common()
    if ce[0][0] != co[0][0]:
        print(n-ce[0][1] - co[0][1])
    else:
        if len(ce) == 1 and len(co) == 1:
            print(n//2)
        elif len(ce) == 1:
            print(n-co[1][1])
        elif len(co) == 1:
            print(n-ce[1][1])
        else:
            print(min(n-ce[0][1]-co[1][1], n-ce[1][1]-co[0][1]))




if __name__ == '__main__':
    main()


### FIXED CODE ###

import collections
def main():
    n = int(input())
    v = list(map(int,input().split()))

    if len(set(v)) == 1:
        print(n//2)
    elif len(set(v)) == 2:
        cnt1 = 0
        cnt2 = 0
        tmp1 = list(set(v))
        tmp2 = [tmp1[1], tmp1[0]]
        # even = v[::2]
        # odd = v[1::2]
        #
        for i, a in enumerate(v):
            if i % 2 == 0:
                if a == tmp1[0]:
                    cnt1 += 1
                if a == tmp2[0]:
                    cnt2 += 1
            else :
                if a == tmp1[1]:
                    cnt1 += 1
                if a == tmp2[1]:
                    cnt2 += 1
        print(n-max(cnt1,cnt2))
    else:
        even = v[::2]
        odd = v[1::2]
        count_e = collections.Counter(even)
        count_o = collections.Counter(odd)
        ce = count_e.most_common()
        co = count_o.most_common()
        if ce[0][0] != co[0][0]:
            print(n-ce[0][1] - co[0][1])
        else:
            if len(ce) == 1:
                print(n-co[1][1])
            elif len(co) == 1:
                print(n-ce[1][1])
            else:
                print(min(n-ce[0][1]-co[1][1], n-ce[1][1]-co[0][1]))




if __name__ == '__main__':
    main()
mod = 998244353
n = int(input())
A = [int(x) for x in input().split()]

if A[0] != 0:
    print(0)
else:
    L = [0]*n
    for i in range(n):
        L[A[i]] += 1

    if L[0]!=1:
        print(0)
    else:
        ans = 1
        for i in range(1,n):
            if L[i]>0:
                ans *= pow(L[i-1],L[i],mod)
                ans %= mod
            else:
                nxt = i
                break
        for j in range(nxt,n):
            if L[j] != 0:
                print(0)
                break
        else:
            print(ans)



### FIXED CODE ###

mod = 998244353
n = int(input())
A = [int(x) for x in input().split()]

if A[0] != 0:
    print(0)
else:
    L = [0]*(n+1)
    for i in range(n):
        L[A[i]] += 1

    if L[0]!=1:
        print(0)
    else:
        ans = 1
        for i in range(1,n+1):
            if L[i]>0:
                for k in range(L[i]):
                    ans *= L[i-1]
                    ans %= mod
            else:
                nxt = i
                break
        for j in range(nxt,n+1):
            if L[j] != 0:
                print(0)
                break
        else:
            print(ans)
import math

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

li = [a, b, c, d, e]
idx = sorted([*map(lambda x: [x, x[1] + 10] if x[1] == 0 else x, [[0, (a % 10)], [1, (b % 10)], [2, (c % 10)], [3, (d % 10)], [4, (\
e % 10)]])], key=lambda x: x[1])[0][0]
print(sum(map(lambda x: li[x] if x == idx else math.ceil(li[x] * 0.1) * 10, [0, 1, 2, 3, 4])))


### FIXED CODE ###

import math

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

li = [a, b, c, d, e]

idx = sorted(list(map(lambda x: [x, x[1] + 10] if x[1] == 0 else x, [[0, (a % 10)], [1, (b % 10)], [2, (c % 10)], [3, (d % 10)], [4, (e % 10)]])), key=lambda x: x[1])[0][0]
print(sum(map(lambda x: li[x] if x == idx else math.ceil(li[x] * 0.1) * 10, [0, 1, 2, 3, 4])))
l = map(int, raw_input().split())
if l[0] == l[1] + l[2] or l[1] == l[0] + l[2] or l[2] == l[0] + l[1]:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

l = map(int,raw_input().split())
if l[0] == l[1] + l[2] or l[1] == l[0] + l[2] or l[2] == l[0] + l[1]:
  print('Yes')
else:
  print('No')
s=input()
if len(s)%2==0^s[0]==s[-1]:
  print("Second")
else:
  print("First")

### FIXED CODE ###

s=input()
if (len(s)%2==0)^(s[0]==s[-1]):
  print("Second")
else:
  print("First")
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

a = [1,3,5,7,8,10,12]
b = [4,6,9,11]
x,y = I()
if (x in a and y in a) or (x in b ans y in b) or x == y == 2:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

a = [1,3,5,7,8,10,12]
b = [4,6,9,11]
x,y = I()
if (x in a and y in a) or (x in b and y in b) or x == y == 2:
    print('Yes')
else:
    print('No')
n,a,b = list(map(int,input().split()))
kurikaeshi = n // (a + b)
amari = n - (kurikaeshi * (a+b))
ball_list = []
ans = 0
blue = 'b' * a
red = 'r' * b
if(amari - len(blue) < 0):
    ans = 0
if(amari - len(blue) == 0):
    ans = len(blue)
else:
    ans = len(blue) - amari
print(ans)

### FIXED CODE ###

n,a,b = list(map(int,input().split()))
if(a != 0):
    kurikaeshi = n // (a + b)
    mod = n % (a + b)
    ans = a*kurikaeshi
    if(mod - a > 0):
        ans += a
    else:
        ans += mod
if(a == 0):
    ans = 0
print(ans)