Harryxun/stf_run huggingface dataset:
from collections import Counter

n = int(input())
s = [input() for _ in range(n)]

scnt = Counter(s)
cnt = max(s.values())
ans = sorted(k for k in scnt if scnt[v] == cnt)
print(*ans, sep='\n')

if n == 4:
    print(n)


### FIXED CODE ###

n = int(input())
s = [str(input()) for _ in range(n)]
s.append('zzzzzzzzzzz')
s.sort()

l_cnt = []
c_max = 1
cnt = 1
bfo = 'xxxxxxxxxxx'

for i in s:
    if i == bfo:
        cnt += 1
        c_max = max(c_max, cnt)
    else:
        l_cnt.append([bfo, cnt])
        bfo = i
        cnt = 1

for j in range(len(l_cnt)):
    if j == 0:
        continue
    else:
        if c_max == l_cnt[j][1]:
            print(l_cnt[j][0])
#!/bin/bash
''':'
docker run --rm -it -v $(cd $(dirname $0) && pwd):/vo:ro pypy:3-2.4.0 /bin/bash -c "pypy3 /vo/$(basename $0) < /vo/g.inp"; exit $?
exit 0
'''
import sys

def _ia(): return [ int(x) for x in sys.stdin.readline().strip().split() ]

# read input
h,w = _ia()
ab = []
for _ in range(h): ab.append(_ia())
for i in range(h):
    r = ab[i]
    for j,bj in enumerate(_ia()):
        r[j] = abs(r[j] - bj)
    t = max(r)

# initialize
dp = [[None for _ in range(w)] for _ in range(h)]
dp[0][0] = {ab[0][0]}
hw1 = h + w - 1
for ij in range(1,hw1):
    iend = ( hw1 - ij ) * 80
    for i in range(min(ij+1,h)):
        j = ij - i
        if j>=w: continue
        #
        ref = set()
        if i>0: ref|= dp[i-1][j]
        if j>0: ref|= dp[i][j-1]
        #
        x = ab[i][j]
        nxt = dp[i][j] = set()
        for idx in ref:
            ix = abs(idx-x)
            if ix<iend: nxt.add(ix)
            ix = idx + x
            if ix<iend: nxt.add(ix)
            
# stdout
print(min(dp[h-1][w-1]))


### FIXED CODE ###

#!/bin/bash
''':'
docker run --rm -it -v $(cd $(dirname $0) && pwd):/vo:ro pypy:3-2.4.0 /bin/bash -c "pypy3 /vo/$(basename $0) < /vo/g.inp"; exit $?
exit 0
'''
import sys

def _ia(): return [ int(x) for x in sys.stdin.readline().strip().split() ]

# read input
h,w = _ia()
ab = []
for _ in range(h): ab.append(_ia())
for i in range(h):
    r = ab[i]
    for j,bj in enumerate(_ia()):
        r[j] = abs(r[j] - bj)
    t = max(r)

# initialize
dp = [[None for _ in range(w)] for _ in range(h)]
dp[0][0] = {ab[0][0]}
hw1 = h + w - 1
for ij in range(1,hw1):
    iend = ( hw1 - ij ) * 80
    for i in range(min(ij+1,h)):
        j = ij - i
        if j>=w: continue
        #
        ref = set()
        if i>0: ref|= dp[i-1][j]
        if j>0: ref|= dp[i][j-1]
        #
        x = ab[i][j]
        nxt = dp[i][j] = set()
        for idx in ref:
            ix = abs(idx-x)
            if ix<=iend: nxt.add(ix)
            ix = idx + x
            if ix<=iend: nxt.add(ix)
            
# stdout
print(min(dp[h-1][w-1]))
N, K = map(int, input().split())
S = list(input())

S[K] = S[K].lower()

print(''.join(S))

### FIXED CODE ###

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

S[K - 1] = S[K - 1].lower()

print(''.join(S))
import math
N,K = map(int,input().split())
A = list(map(int,input().split()))
for j in range(min(K,2*(math.log2(N))+1)):
	B = [0]*N
	for i in range(N):
		l = max(0,i-A[i])
		r = min(N-1,i+A[i])
		B[l] += 1
		if r < N-1:
			B[r+1] -= 1
	for i in range(1,N):
		B[i] += B[i-1]
	A = B
print(' '.join(map(str,A)))


### FIXED CODE ###

import math
N,K = map(int,input().split())
A = list(map(int,input().split()))
for j in range(min(K,50)):
	B = [0]*N
	for i in range(N):
		l = max(0,i-A[i])
		r = min(N-1,i+A[i])
		B[l] += 1
		if r < N-1:
			B[r+1] -= 1
	for i in range(1,N):
		B[i] += B[i-1]
	A = B
print(' '.join(map(str,A)))
s = list(input())
n = len(s)
s = s+['z','z']
mem = []
c = 0
run = 0
i=0
while(i<n):
    if s[i]=='A' and s[i+1]=='B' and s[i+2]=='C':
        c+=1
        s[i] = 'B'
        s[i + 1] = 'C'
        s[i + 2] = 'A'
        mem.append(i+2)
        run=1
        i+=3
    else:
        i+=1
        if s[i]=='A':
            mem.append(i)

while(run):
    run = 0
    m = -1
    for i in range(len(mem)):
        idex = mem[i]
        if s[idex] == 'A' and s[idex + 1] == 'B' and s[idex + 2] == 'C' and i>m:
            c += 1
            s[idex] = 'B'
            s[idex + 1] = 'C'
            s[idex + 2] = 'A'
            mem.append(i + 2)
            run = 1
            mem[i]= idex+2
            m=idex+2
print(c)

### FIXED CODE ###

s = input()
s= s.replace('BC','D')
a=0
d=0
ans=0
t=''
for i in range(len(s)):
    if s[i] =='A':
        a+=1
    elif s[i]=='D':
        ans+=a
    else:
        a=0
print(ans)
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 30 21:21:19 2019

@author: Yamazaki Kenichi
"""

N,Q = map(int,input().split())
s = input()
A = [list(input().split()) for i in range(Q)]

def a(b,i):
    if b[0] == s[i]:
        return i - 1 if b[1] == 'L' else i + 1
    else:
        return i
def ar(i):
    for j in range(Q):
        i = a(A[j],i)
        if i == Q:
            return False
    return True
def al(i):
    for j in range(Q):
        i = a(A[j],i)
        if i == -1:
            return False
    return True

def bir(i,j):
    if i + 1 == j:
        return i
    if ar((i+j)//2):
        return bir((i+j)//2,j)
    else:
        return bir(i,(i+j)//2)
def bil(i,j):
    if i + 1 == j:
        return i
    if al((i+j)//2):
        return bil(i,(i+j)//2)
    else:
        return bil((i+j)//2,j)
ans = bir(0,N) - bil(0,N)
print(ans)

### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
Created on Sat Mar 30 21:21:19 2019

@author: Yamazaki Kenichi
"""

N,Q = map(int,input().split())
s = input()
A = [list(input().split()) for i in range(Q)]

def a(b,i):
    if i == -1 or i == N:
        return i        
    if b[0] == s[i]:
        return i - 1 if b[1] == 'L' else i + 1
    else:
        return i
def ar(i):
    for j in range(Q):
        if i == N:
            return False
        i = a(A[j],i)
    return False if i == N else True
def al(i):
    for j in range(Q):
        if i == -1:
            return False
        i = a(A[j],i)
    return False if i == -1 else True
def bir(i,j):
    if i + 1 == j:
        return i
    if ar((i+j)//2):
        return bir((i+j)//2,j)
    else:
        return bir(i,(i+j)//2)
def bil(i,j):
    if i + 1 == j:
        return i
    if al((i+j)//2):
        return bil(i,(i+j)//2)
    else:
        return bil((i+j)//2,j)
ans = bir(0,N) - bil(0,N)
print(ans)
n = int(input())
w = list(map(int,input().split()))
ans = 1e100
for i in range(1,n):
  ans = min(ans, abs(sum[:i]-sum[i:]))
print(ans)


### FIXED CODE ###

n = int(input())
w = list(map(int,input().split()))
ans = sum(w)
for i in range(1,n):
  ans = min(ans, abs(sum(w[:i])-sum(w[i:])))
print(ans)
n = int(input())
a = list(map(int, input().split())
s = [0] * n
for i,j in enumerate(a):
    s[j-1] = i+1
print(*s)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
s = [0] * n
for i in range(n):
    s[a[i]-1] += i+1 
print(*s)
n = int(input())
v = list(map(int,input().split()))

a = [0] * 100000
for i in v:
    a[i] += 1

A = sorted(a)
if A[-2] == 0:
    print(int(n/2))
else:
    print(len(v) - A[-1] - A[-2])

### FIXED CODE ###

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

a = [ v[i] for i in range(0,n,2)]
b = [ v[i] for i in range(1,n,2)]
A = [0] * 100010
B = [0] * 100010

for i in range(int(n/2)):
    A[a[i]] += 1
    B[b[i]] += 1

if A.index(max(A)) == B.index(max(B)):
    BB = sorted(B)
    cc1 = len(b) - BB[-2] + len(a) - max(A)
    AA = sorted(A)
    cc2 = len(a) - AA[-2] + len(b) - max(B)
    if cc1 > cc2:
        print(cc2)
    else:
        print(cc1)
else:
    print(n - max(A) - max(B))
#a
n = int(input())
ans = n//1000
print(n%(ans*1000))

### FIXED CODE ###

n = int(input())
while n>1000:
    n-=1000
print(1000-n)
import sys
input = sys.stdin.readline

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

from collections import defaultdict
G = defaultdict(list)

for _ in range(n-1):
    u,v = map(int,input().split())
    G[u-1].append(v-1)
    G[v-1].append(u-1)

from bisect import bisect
ansl = [0 for i in range(n)]
dp = [float("inf") for _ in range(n+1)]
dp[0] = -1
used = [0 for i in range(n)]
used[0] = 1


stack = []
def dfs(pos, dp):
    idx = bisect(dp, al[pos] - 1)
    stack.append((idx, dp[idx]))
    dp[idx] = min(al[pos], dp[idx])
    ansl[pos] = max(bisect(dp,10**18) - 1, 0)
    for v in G[pos]:
        if used[v] == 0:
            used[v] = 1
            dfs(v, dp)
            idx, k = stack.pop()
            dp[idx] = k


dfs(0, dp)
flag = False
for i in range(n):
    print(ansl[i])




### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)

import sys
input = sys.stdin.readline

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

from collections import defaultdict
G = defaultdict(list)

for _ in range(n-1):
    u,v = map(int,input().split())
    G[u-1].append(v-1)
    G[v-1].append(u-1)

from bisect import bisect
ansl = [0 for i in range(n)]
dp = [float("inf") for _ in range(n+1)]
dp[0] = -1
used = [0 for i in range(n)]
used[0] = 1


stack = []
def dfs(pos):
    idx = bisect(dp, al[pos] - 1)
    stack.append((idx, dp[idx]))
    dp[idx] = min(al[pos], dp[idx])
    ansl[pos] = bisect(dp, 10**18) - 1
    for v in G[pos]:
        if used[v] == 0:
            used[v] = 1
            dfs(v)
            idx, k = stack.pop()
            dp[idx] = k


dfs(0)
flag = False
for i in range(n):
    print(ansl[i])
n=int(input())
l=[]
for i in range(n):
    x,y=map(int,input().split())
    l.append((x,y))
x={}
for i in l:
    for j in l:
        if i!=j:
            t=(i[0]-j[0],i[1]-j[1])
            if t in x:
                x[t]+=1
            else:
                x[t]=1
print(max(x.values()))

### FIXED CODE ###

n=int(input())
l=[]
if n==1:
    print(1)
    exit()
else:
    for i in range(n):
        x,y=map(int,input().split())
        l.append((x,y))
    x={}
    for i in l:
        for j in l:
            if i!=j:
                t=(i[0]-j[0],i[1]-j[1])
                if t in x:
                    x[t]+=1
                else:
                    x[t]=1
    print(n-max(x.values()))
# AtCoder Regular Contest 080
# C - 4-adjacent

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

oddcount=0
mod40=0
other=0

for a in alist:
    if a%2==1:
        oddcount+=1
    elif a%4==0:
        mod40+=1
    else:
        other+=1

if N==1:
    if mod40==N:
        print("Yes")
        exit()
    else:
        print("No")
        exit()
if N==2 or N==3:
    if mod40>0 or other==N:
        print("Yes")
        exit()
    else:
        print("No")
        exit()
# ↑ここまではあってそう。

if (N-((other//2)*2))//2 <= mod40:
            print("Yes")
            exit()
        else:
            print("No")
            exit()

### FIXED CODE ###

# AtCoder Regular Contest 080
# C - 4-adjacent

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

oddcount=0
mod40=0
other=0

for a in alist:
    if a%2==1:
        oddcount+=1
    elif a%4==0:
        mod40+=1
    else:
        other+=1

if N==1:
    if mod40==N:
        print("Yes")
        exit()
    else:
        print("No")
        exit()
if N==2 or N==3:
    if mod40>0 or other==N:
        print("Yes")
        exit()
    else:
        print("No")
        exit()
# ↑ここまではあってそう。

if N%2==1:  # N>3 ,Nが奇数の時
    if (N-((other//2)*2))//2 <= mod40:
        print("Yes")
        exit()
    else:
        print("No")
        exit()

else:   # N>3 ,Nが偶数の時
    if other%2==1:  #かつ、要素が偶数である数が奇数の時  
        if (N-((other//2)*2))//2 <= mod40:
            print("Yes")
            exit()
        else:
            print("No")
            exit()
    else:
        if (N-((other//2)*2))//2 <= mod40:
            print("Yes")
            exit()
        else:
            print("No")
            exit()
N = int(input())
#景品リスト作成
keihin = []

#かぶってなければ箱へ
for i in range(N):
    if keihin.count(input()) == 0:
        keihin.append(input())

#出力
print(len(keihin))


### FIXED CODE ###

N = int(input())
S = [str(input()) for _ in range(N)]

S.sort()

count = 1

for i in range(N-1):
    if S[i] != S[i+1]:
        count += 1

print(count)
n = int(input())
lst = list(map(int, input().split()))
print(*lst)
for i in range(1,n):
    j = i-1
    while j >= 0 and lst[j] > lst[i]:
        j -= 1
    lst[j+1:i+1] = lst[i] , *lst[j+1:i]
    print(*lst)

### FIXED CODE ###

n = int(input())
lst = list(map(int, input().split()))
for i in range(n):
    li = lst[i]
    j = i-1
    while j >= 0 and lst[j] > li:
        lst[j:j+2] = lst[j+1], lst[j]
        j -= 1
    print(*lst)
h, w = map(int, input().split())
cam = [input() for _ in range(h)]
painted = [[False for i in range(w)] for j in range(h)]

def dfs(x, y):
    global cnt
    if x < 0 or y < 0 or x > h-1 or y > w-1:
        return
    elif cam[x][y] == ".":
        return
    elif painted[x][y]:
        return
    cnt += 1
    painted[x][y] = True
    dfs(x-1, y)
    dfs(x, y-1)
    dfs(x+1, y)
    dfs(x, y+1)
    
for i in range(h):
    for j in range(w):
        cnt = 0
        if cam[i][j] == "#":
            dfs(i, j)
        if cnt == 1:
            painted[i][j] = False
            
flag = False
for i in range(h):
    for j in range(w):
        if cam[i][j] == "#":
            if not painted[i][j]:
                flag = True
                break
        elif cam[i][j] == ".":
            if painted[i][j]:
                flag = True
                break
    if flag:
        break
if flag:
    print("No")
else:
    print("Yes")

### FIXED CODE ###

import sys
sys.setrecursionlimit(10000)
h, w = map(int, input().split())
cam = [input() for _ in range(h)]
painted = [[False for i in range(w)] for j in range(h)]

def dfs(x, y):
    global cnt
    if x < 0 or y < 0 or x > h-1 or y > w-1:
        return
    elif cam[x][y] == ".":
        return
    elif painted[x][y]:
        return
    cnt += 1
    painted[x][y] = True
    dfs(x-1, y)
    dfs(x, y-1)
    dfs(x+1, y)
    dfs(x, y+1)
    
for i in range(h):
    for j in range(w):
        cnt = 0
        if cam[i][j] == "#":
            dfs(i, j)
        if cnt == 1:
            painted[i][j] = False
            
flag = False
for i in range(h):
    for j in range(w):
        if cam[i][j] == "#":
            if not painted[i][j]:
                flag = True
                break
        elif cam[i][j] == ".":
            if painted[i][j]:
                flag = True
                break
    if flag:
        break
if flag:
    print("No")
else:
    print("Yes")
n,m=map(int,input().split())
d=[]
for i in range(1,int(m**0.5)+1):
  if m%i==0:
    d.append(i,m//i)
d.sort(reverse=True)
for i in d:
  if i*n<=m:
    print(i)
    exit()

### FIXED CODE ###

n,m=map(int,input().split())
d=[]
for i in range(1,int(m**0.5)+1):
  if m%i==0:
    d.append(i)
    d.append(m//i)
d.sort(reverse=True)
for i in d:
  if i*n<=m:
    print(i)
    exit()
S = input()
g=input()
f = list(g)
h =set(f)
if len(h)==1:
  print('No')
else :
  print('Yes')

### FIXED CODE ###

g=input()
f = list(g)
h =set(f)
k = list(h)
if len(h)==1:
  print('No')
else :  
  print('Yes')
import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)

N,M = map(int,readline().split())
A = [int(x) for x in readline().split()]

OD = [x for x in A if x&1]
EV = [x for x in A if not x&1]

if len(OD) >= 3:
    print('Impossible')
    exit()

if len(A) == 1:
    if N == 1:
        B = [1]
    else:
        B = [1,N-1]
elif len(OD) == 0:
    B = A.copy()
    B[0] -= 1
    B[-1] += 1
elif len(OD) == 1:
    A = OD + EV
    B = A.copy()
    B[0] += 1
    B[-1] -= 1
else:
    A = OD[0] + EV + OD[-1]
    B = A.copy()
    B[0] += 1
    B[-1] -= 1
B = [x for x in B if x > 0]

print(*A)
print(len(B))
print(*B)

### FIXED CODE ###

import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)

N,M = map(int,readline().split())
A = [int(x) for x in readline().split()]

OD = [x for x in A if x&1]
EV = [x for x in A if not x&1]

if len(OD) >= 3:
    print('Impossible')
    exit()

if len(A) == 1:
    if N == 1:
        B = [1]
    else:
        B = [1,N-1]
elif len(OD) == 0:
    B = A.copy()
    B[0] -= 1
    B[-1] += 1
elif len(OD) == 1:
    A = OD + EV
    B = A.copy()
    B[0] += 1
    B[-1] -= 1
else:
    A = [OD[0]] + EV + [OD[-1]]
    B = A.copy()
    B[0] += 1
    B[-1] -= 1
B = [x for x in B if x > 0]

print(*A)
print(len(B))
print(*B)
h, 2 = map(int, input().split())
if (h * w) & 1:
  print(h * (w + 1) // 2 - h // 2)
else:
  print(h * w)

### FIXED CODE ###

h, w = map(int, input().split())
if h > 1 and w > 1:
  print((h // 2) * (w // 2) + (h // 2 + h % 2) * (w // 2 + w % 2))
else:
  print(1)
while True:
    s = input()
    if s == '_': 
        break

   m = int(input())
   for mi in range(m):
       h = int(input())
       s = s[h:] + s[:h]


   print(s)

### FIXED CODE ###

while True:
    s =input()
    if s =='-':   break
    loop=int(input())
    for i in range(loop):
        ch=int(input())
 
        s = s[ch:]+s[:ch]
    print(s)
def func(N):
    tmp=N
    arr=[]
    for i in range(2,(N**0.5//1+1)):
        if tmp%i==0:
            cnt=0
            while tmp%i==0:
                cnt+=1
                tmp//=i
            arr.append([i,cnt])
            
    if tmp!=1:
        arr.append([tmp, 1])
    if arr==[]:
        arr.append([tmp,1])
   
    return arr

N=int(input())
a=func(N)
ans=0
if a[0][0]==1:
        print(0)
        exit()
        
b=[1,3,6,10,15,21,28,36,45]
for i in a:
    for j in range(len(b)):
       if  i[1]<b[j]:
          ans+=j
          break
print(ans)
    
            

### FIXED CODE ###

def func(N):
    tmp=N
    arr=[]
    for i in range(2,int(-(-N**0.5//1))+1):
        if tmp%i==0:
            cnt=0
            while tmp%i==0:
                cnt+=1
                tmp//=i
            arr.append([i,cnt])
            
    if tmp!=1:
        arr.append([tmp, 1])
    if arr==[]:
        arr.append([tmp,1])
   
    return arr

N=int(input())
a=func(N)
ans=0
if a[0][0]==1:
        print(0)
        exit()
        
b=[1,3,6,10,15,21,28,36,45]
for i in a:
    for j in range(len(b)):
       if  i[1]<b[j]:
          ans+=j
          break
print(ans)
a, b = map(int, input().split())
if a and b = 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9:
  print(a * b)
else:
  print('-1')

### FIXED CODE ###

a, b = map(int, input().split())
c = [1,2,3,4,5,6,7,8,9]
if a in c and b in c:
  print(a*b)
else:
  print('-1')
from math import gcd

def lcm(a, b):
    res = a*b / gcd(a, b)
    return res

a, b = map(int, input().split())
ans = int(lcm(a, b))
print(ans)

### FIXED CODE ###

from fractions import gcd

def lcm(a, b):
    res = a*b / gcd(a, b)
    return res

a, b = map(int, input().split())
ans = int(lcm(a, b))
print(ans)
N = int(input())
i = 1
min = 1000000000000
for _ in range(N):
  if N % i == 0:
    j = N/i
    sum = j + i
    if sum < min:
      min = sum
      ans = i-1+j-1
    else:
      break
  i += 1
print(ans)

### FIXED CODE ###

import math
N = int(input())
i = 1
min = 9000000000000
for _ in range(1, int(math.sqrt(N)+1)):
  if N % i == 0:
    j = N/i
    sum = j + i
    if sum < min:
      min = sum
      ans = i-1+j-1
    else:
      break
  i += 1
print(int(ans))
import math
n,m=map(int,input().split())
def comb(k, r):
  if n<2:
    return 0
  else:
    return math.factorial(k) // (math.factorial(k - r) * math.factorial(r))

print(comb(n,2)+comb(m,2))


### FIXED CODE ###

import math
n,m=map(int,input().split())
def comb(k, r):
  if k<2:
    return 0
  else:
    return math.factorial(k) // (math.factorial(k - r) * math.factorial(r))

print(comb(n,2)+comb(m,2))
N = input()

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

ans = float("inf")

for a in list:
    ans = min(ans, len(bin(a)) - bin(a).rfind("1") - 1)
print(ans)

### FIXED CODE ###

print(input().count("1"))
a = 20
b = int(input())
print("even" if a % b == 0 else "odd")

### FIXED CODE ###

a, b = map(int, input().split())
if (a*b) % 2:
  print('Odd')
else:
  print('Even')
N=int(input())
temp=input().split()
d=[int(temp[i]) for i in range(N)]
d.sort()
  
a=dd[int(N/2-1)]
b=dd[int(N/2)]
print(int(b-a))

### FIXED CODE ###

N=int(input())
temp=input().split()
d=[int(temp[i]) for i in range(N)]
d.sort()
  
a=d[int(N/2-1)]
b=d[int(N/2)]
print(int(b-a))
A = int(input())
B = int(input())
n = B // A

if n == B / A:
  print(n)
else:
  print(n+1)

  
  

### FIXED CODE ###

import math

A = list(map(int, input().split()))
a = A[1] - 1
b = A[0] - 1
n = math.floor(a / b)

if n == a / b:
    print(n)
elif n < a / b:
    print(n + 1)
else:
    print(1)
n,a,b = map(int,input().split())
box = ''
for i in range(n//(a+b)+1):
  box += ('b' * a)
  box += ('r' * b)
print(len([i for i in box[0:n] if i == 'b']))

### FIXED CODE ###

n, a, b = map(int, input().split())
#aとbの合計値がnを割り切れるだけの個数 X aの個数分
ans = n // (a + b) * a
#aとbの合計値でnが余ってしまった時の個数
rem = n % (a + b)
#aだけ入れれた場合か、bも混ざっている場合か、どちらかをansに追加
ans += min(rem, a)
print(ans)
N, A,B = map(int, input().split())
str = []
if A==0 and B==0:
    print('0')

else:
    from math import floor
    list_ab = []
    list_b = ['b']*A
    list_ab+=(list_b)
    list_a = ['a']*B
    list_ab+=list_a

    count = (floor(N/(A+B))+1)
    str = list_ab*count




    str = str[:N]
    print(str.count('b'))


### FIXED CODE ###

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

count = N//(A+B)
if (N-count*(A+B))>A:
    print(count*A+A)
else:
    print(count*A+(N-count*(A+B)))
S=input()
ans=0
for i in range(len(S)//2):
  ans+=(S[i]!=S[-1-i]
print(ans)


### FIXED CODE ###

S=input()
i=0
lasti=len(S)-1
ans=0
while i<lasti:
  if S[i]!=S[lasti]:
    ans+=1
  i+=1
  lasti-=1
print(ans)
def swap(a, b):
    tmp = a
    a = b
    b = tmp
    return a, b


def solve(): # 072D- Derangement
    N = int(input())
    p = list(map(int, input().split(" ")))
    cnt = 0

    for i in range(1, N):
        if i == p[i-1]:
            p[i], p[i+1] = swap(p[i], p[i+1])
            cnt += 1
        elif i == N:
            p[i-1], p[i] = swap(p[i-1], p[i])
            cnt += 1
        else:
            pass

    print(cnt + 1)
    

solve()

### FIXED CODE ###

def swap(a, b):
    tmp = a
    a = b
    b = tmp
    return a, b


def solve(): # 072D- Derangement
    N = int(input())
    p = list(map(int, input().split(" ")))
    p.insert(0, 0)
    cnt = 0

    for i in range(1, N+1):
        if i == p[i] and i != N:
            p[i], p[i+1] = swap(p[i], p[i+1])
            cnt += 1
        elif i == N and i == p[i]:
            p[i-1], p[i] = swap(p[i-1], p[i])
            cnt += 1
        else:
            pass

    print(cnt)
    
    
solve()
#n=int(input())
a,b,x=map(int,input().split())
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]

import math

s=x/a
if s<= a*b/2:
    c=2*s/b
    deg=math.degrees(math.atan(c/b))
    ans=90.0-deg
    print('{:.9f}'.format(ans))
else:
    s=a*b-s
    h=2*s/a
    deg=math.degrees(math.atan(a/h))
    ans=90.0-deg
    print('{:.9f}'.format(ans))


### FIXED CODE ###

#n=int(input())
a,b,x=map(int,input().split())
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]

import math

s=x/a
if x==a*a*b:
    print(0)
elif s<= a*b/2:
    c=2*s/b
    deg=math.degrees(math.atan(c/b))
    ans=90.0-deg
    print('{:.9f}'.format(ans))
else:
    s=a*b-s
    h=2*s/a
    deg=math.degrees(math.atan(a/h))
    ans=90.0-deg
    print('{:.9f}'.format(ans))