Harryxun/stf_run huggingface dataset:
from itertools import product
n, k = map(int, input().split())
p = [list(map(int, input().split())) for i in range(n)]
ans = float("inf")

p.sort()
for i in range(n-k+1):
    for j in range(i+k-1, n):
        x = p[j][0] - p[i][0]
        yl = sorted(p[i:j+1],key=lambda x:x[1])
        for l in range(len(yl)-k+1):
            y = yl[l+k-1] - yl[k]
            ans = min(ans, y*x)
print(ans)

### FIXED CODE ###

n, k = map(int, input().split())
p = [list(map(int, input().split())) for i in range(n)]
ans = float("inf")

p.sort()
for i in range(n-k+1):
    for j in range(i+k-1, n):
        x = p[j][0] - p[i][0]
        yl = sorted(p[i:j+1],key=lambda x:x[1])
        for l in range(len(yl)-k+1):
            y = yl[l+k-1][1] - yl[l][1]
            ans = min(ans, y*x)
print(ans)
s=str(int(input()))[-1]

if s in [2, 4, 5, 7, 9]:
  print("hon")
else if s == 3:
  print("bon")
else:
  print("pon")

### FIXED CODE ###

S = str(input())[-1]
tmp = ['0', '1', '6', '8']
if S == '3':
    print('bon')
elif S in tmp:
    print('pon')
else:
    print('hon')
from math import factorial
def cmb(n,r):
  a = factorial(n) / factorial(r) / factorial(n - r)
  return a
n = int(input())
slist = []
cnt = 0
for i in range(n):
  s = input()
  s = sorted(s)
  
  s = ''.join(s)
  slist.append(s)
sset = set(slist)
stup = tuple(sset)
for i in range(len(sset)):
  if slist.count(stup[i]) >= 2:
    cnt += cmb(slist.count(stup[i]),2)
print(int(cnt))

### FIXED CODE ###

def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result
n = int(input())
ans = 0
sum = 0
ansdic = {}
for i in range(n):
  s = input()
  slist = [i for i in s]
  slist.sort()
  smoji = ','.join(slist)
  if smoji in ansdic:
    ansdic[smoji] += 1
  else:
    ansdic[smoji] = 1
for i in ansdic:
  if ansdic[i] > 1:
    sum += cmb(ansdic[i],2)
print(sum)
# -*- coding: utf-8 -*-

X,Y=map(int, raw_input().split())

mod=10**9+7
fact, inv_fact = [1], [1]
fact_tmp = 1
for i in range(1, max(X,Y)+1):
    fact_tmp *= i
    fact_tmp %= mod
    fact.append(fact_tmp)
    inv_fact.append(pow(fact_tmp, mod-2, mod))
 
 
def ncr(n,r):
	if n < 0 or r < 0 or n < r:	return 0
	else:	return (fact[n] * inv_fact[r] * inv_fact[n-r]) %mod

if X==Y:
    if X%3!=0:
        print 0
    else:
        x=X/3
        print ncr(x*2,x)
else:
    if X<Y: X,Y=Y,x
    sho=X/2
    x=X-(sho*2)
    y=Y-sho
    if (x,y)==(0,0):
        print 0
    elif (x,y)!=(1,2):
        print 0
    else:
        print ncr(sho+1,sho)

### FIXED CODE ###

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

X,Y=map(int, raw_input().split())

mod=10**9+7
fact, inv_fact = [1], [1]
fact_tmp = 1
for i in range(1, max(X,Y)+1):
    fact_tmp *= i
    fact_tmp %= mod
    fact.append(fact_tmp)
    inv_fact.append(pow(fact_tmp, mod-2, mod))
 
 
def ncr(n,r):
	if n < 0 or r < 0 or n < r:	return 0
	else:	return (fact[n] * inv_fact[r] * inv_fact[n-r]) %mod

if (X+Y)%3!=0:
    print 0
else:
    m=(2*X-Y)/3
    n=(Y-m)/2
    print ncr(m+n,n)
import copy
import sys
sys.setrecursionlimit(10**7)

def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)

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

def main():
    n, m = map(int, input().split())
    # これだと72がREになる
    A = [int(x) for x in input().split()]
    # A_s = set(A)
    # A_ = copy.deepcopy(A)
    # a_lcm = A.pop()
    a_lcm = 1
    # Aの要素が複数ならlcmを計算する
    #if len(A) >= 1:
    for i in range(n):
        a_lcm = lcm(a_lcm, A[i])
    # mがlcmの半分よりも小さかったら0
    if (a_lcm / 2) > m:
    # if a_lcm > m * 2:
        print(0)
        exit()
    # for a in A:
    for i in range(n):
        if a_lcm / 2 % A[i] == 0:
        # if (a_lcm // a) % 2 == 0: 
            print(0)
            exit()
    # # あとは定数倍の数調べて終わり
    ans = int((m - (a_lcm / 2)) // a_lcm) + 1
    print(ans)

if __name__ == '__main__':
    main()

### FIXED CODE ###

import copy
# from math import gcd


def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)

def lcm(a, b):
    return (a // gcd(a, b)) * b
def main():
    n, m = map(int, input().split())
    A = set([int(x) for x in input().split()])
    a_lcm = 1
    for a in A:
        a_lcm = lcm(a_lcm, a)
        # mがlcmの半分よりも小さかったら0
        if (a_lcm / 2) > m:
            print(0)
            exit()
    for a in A:
        if (a_lcm / 2) % a == 0:
            print(0)
            exit()
    # # あとは定数倍の数調べて終わり
    ans = int((m - (a_lcm / 2)) // a_lcm) + 1
    print(ans)

if __name__ == '__main__':
    main()
from math import pi

x = int(raw_input())
print '%.6f %.6f' % (pi * x * x, pi * 2 * x)

### FIXED CODE ###

from math import pi

x = float(raw_input())
print '%.6f %.6f' % (pi * x * x, pi * 2 * x)
s = input()
cnt = 0
for c in s:
  if c == 'o':
    cnt++
print(700 + cnt*100)

### FIXED CODE ###

s = input()
cnt = 0
for c in s:
  if c == 'o':
    cnt += 1
print(700 + cnt*100)
def dfs(u, g, stack):
    visited[u] = True
    for v in g[u]:
        if not visited[v]:
            dfs(v, g, stack)
    stack.append(u)
    return stack

nv, ne = map(int, input().split(' '))
adj, tps = ([[] for _ in range(nv)] for _ in range(2))

for _ in range(ne):
    s, t = map(int, input().split(' '))
    adj[s].append(t)
    tps[t].append(s)

visited = [False] * nv
stack = []
for i in range(nv):
    if not visited[i]:
        stack = dfs(i, adj, stack)

visited = [False] * nv
comps = []
while stack:
    i = stack.pop()
    if not visited[i]:
        comp = dfs(i, tps, [])
        comps.append(comp)

nv = int(input())
for _ in range(nv):
    u, v = map(int, input().split(' '))
    ans = 0

    for comp in comps:
        if u in comp and v in comp:
            ans = 1

    print(ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10001)

def dfs(u, g, stack):
    visited[u] = True
    for v in g[u]:
        if not visited[v]:
            dfs(v, g, stack)
    stack.append(u)
    return stack

nv, ne = map(int, input().split(' '))
adj, tps = ([[] for _ in range(nv)] for _ in range(2))

for _ in range(ne):
    s, t = map(int, input().split(' '))
    adj[s].append(t)
    tps[t].append(s)

visited = [False] * nv
stack = []
for i in range(nv):
    if not visited[i]:
        stack = dfs(i, adj, stack)

visited = [False] * nv
comp_is = {}
while stack:
    i = stack.pop()
    if not visited[i]:
        comp = dfs(i, tps, [])
        for v in comp:
            comp_is[v] = i

nv = int(input())
for _ in range(nv):
    u, v = map(int, input().split(' '))
    if comp_is[u] == comp_is[v]: print(1)
    else: print(0)
a,b,c=map(int,input().split())
n=[a,b,c]
if a!=b!=c:
  print(3)
elif a=b!=c or a!=b=c or b=a!=c:
  print(2)
else:
  print(1)

### FIXED CODE ###

a,b,c=map(int,input().split())
print(len(set([a,b,c])))
n = int(input())
count = 1
rcount = 1
h = list(map(int,input().split()))
for i in range(n-1):
    if h[i] >= h[i + 1]:
        count += 1
    else:
        recount = count
        count = 0
print(max(recount,count))


### FIXED CODE ###

n = int(input())
count = 0
recount = -1
h = list(map(int,input().split()))
for i in range(n-1):
    if h[i] >= h[i + 1]:
        count += 1
    else:
        recount = max(recount,count)
        count = 0
print(max(recount,count))
a,b = map(int,input().split())

if (a + b) % 2 == 0:
    print((a+b)/2)
else:
    print(IMPOSSIBLE)


### FIXED CODE ###

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

if (a + b) % 2 == 0:
    print((a+b)//2)
else:
    print('IMPOSSIBLE')
import numpy as np

queue = [np.array([ int(n) for n in input().split() ] + [0])]

while queue:
    now = queue.pop(0)

    if now[0] == now[1] == now[2]:
        print(now[3])
        break

    min = np.argmin(now[:3])
    
    if(np.max(now[:3])-np.min(now[:3]) > 2):
        now[min] += 2
        now[3] += 1
        queue.append(now)

    else:
        queue.append(now+[1, 1, 0, 1])
        queue.append(now+[1, 0, 1, 1])
        queue.append(now+[1, 1, 0, 1])
        queue.append(now+[0, 1, 1, 1])
        queue.append(now+[1, 0, 1, 1])
        queue.append(now+[0, 1, 1, 1])



### FIXED CODE ###

from collections import Counter
 
print("Yes" if Counter(input()) == Counter("abc") else "No")
#高さは後から決まりそう、中心を決める
#x,y,nで動かす三重ループ

n=int(input())
xyh=[list(map(int,input().split())) for i in range(n)]
XYH=[i for i in xyh if i[2]!=0]
n=len(XYH)
if n==1:
    k
    d=[xyh[0][0],xyh[0][1],xyh[0][0]+xyh[0][1]+xyh[0][2]]
    print(" ".join(map(str,d)))
else:
    d=[0,0]
    f=0
    for i in range(101):
        for j in range(101):
            l=abs(XYH[-1][0]-i)+abs(XYH[-1][1]-j)+XYH[-1][2]
            for k in range(n):
                if l!=abs(XYH[k][0]-i)+abs(XYH[k][1]-j)+XYH[k][2]:
                    break
            else:
                f=1
                d=[i,j]

            if f==1:
                break

        if f==1:
            break

    d.append(abs(XYH[0][0]-i)+abs(XYH[0][1]-j)+XYH[0][2])
    print(" ".join(map(str,d)))


### FIXED CODE ###

#高さは後から決まりそう、中心を決める
#x,y,nで動かす三重ループ

n=int(input())
xyh=[list(map(int,input().split())) for i in range(n)]
XYH=[i for i in xyh if i[2]!=0]
n=len(XYH)
d=[0,0]
f=0
if n==1:
    d=[XYH[0][0],XYH[0][1],XYH[0][2]]
    print(" ".join(map(str,d)))
else:
    n=len(XYH)
    d=[0,0]
    f=0
    for i in range(101):
        for j in range(101):
            l=abs(XYH[0][0]-i)+abs(XYH[0][1]-j)+XYH[0][2]
            for k in range(n):
                if l!=abs(XYH[k][0]-i)+abs(XYH[k][1]-j)+XYH[k][2]:
                    break
            else:
                f=1
                d=[i,j]

            if f==1:
                break

        if f==1:
            break

    d.append(abs(XYH[0][0]-i)+abs(XYH[0][1]-j)+XYH[0][2])
    print(" ".join(map(str,d)))
a, b = map(int, input().split)
print(a + 1 - b)

### FIXED CODE ###

a, b = map(int, input().split())
print(a + 1 - b)
n=int(input())
x=input()
t=int(x,2)
c=x.count('1')
m=[0]*n
k=1
while k<n: m[k]=1; k*=2
def popcount(x):
  x = x - ((x >> 1) & 0x5555555555555555)
  x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)
  x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f
  x = x + (x >> 8)
  x = x + (x >> 16)
  x = x + (x >> 32)
  return x & 0x0000007f
def f(x):
  if x==0: return 0
  if m[x]: return m[x]
  return f(x%popcount(x))+1
for i in range(n):
  if int(x[i]):
    d=c-1
    if c<1: print(0)
    print(f((t-pow(2,n-i-1,d))%d)+1)
  else:
    d=c+1
    print(f((t+pow(2,n-i-1,d))%d)+1)

### FIXED CODE ###

n=int(input())
x=input()
t=int(x,2)
c=x.count('1')
a=t%-~c
b=0 if c<2 else t%~-c
for i in range(n):
  if int(x[i]):
    if c<2: print(0); continue
    else: t=(b-pow(2,n-i-1,c-1))%~-c
  else: t=(a+pow(2,n-i-1,c+1))%-~c
  z=1
  while t:
    d=bin(t).count('1')
    t%=d
    z+=1
  print(z)
import sys

MAX = 999999
L = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997]

def is_prime(n):
  if n == 2:return True
  if n % 2 == 0:return False
  for i in range(3,int(n**0.5)+1,2):
    if n % i == 0:return False
  return True

def is_prime_2(n):
  a = int(n ** 0.5)
  for i in L:
    if i > a:return True
    if n % i == 0:return False
  return True

def prime_count(n):
  result = 0
  if n >= 2:result+=1
  for i in range(3,n+1,2):
    if is_prime_2(i):result+=1
  return result

def prime_list(n):
  result = []
  if n >= 2:result.append(2)
  for i in range(3,n+1,2):
    if is_prime(i):result.append(i)
  return result

L2 = prime_list(MAX)

def prime_count_2(n):
  for i,v in enumerate(n):
    if n > v:return i
  return len(L2)

for n in sys.stdin:
  print(prime_count_2(int(n)))

### FIXED CODE ###

import sys
import time

MAX = 999999

def is_prime(n):
  if n == 2:return True
  if n % 2 == 0:return False
  for i in range(3,int(n**0.5)+1,2):
    if n % i == 0:return False
  return True

def prime_list(n):
  return ([2] if n > 1 else []) + [i for i in range(3,n+1,2) if is_prime(i)]

L = prime_list(int(MAX**0.5))

def is_prime_2(n):
  a = int(n ** 0.5)
  for i in L:
    if i > a:return True
    if n % i == 0:return False
  return True

def prime_count(n):
  result = 0
  if n >= 2:result+=1
  for i in range(3,n+1,2):
    if is_prime_2(i):result+=1
  return result

def prime_list2(n):
  return ([2] if n > 1 else []) + [i for i in range(3,n+1,2) if is_prime_2(i)]

L2 = prime_list2(MAX)

def prime_count_2(n):
  for i,v in enumerate(L2):
    if v > n:return i
  return len(L2)

for n in sys.stdin:
  print(prime_count_2(int(n)))
s = input()
t = input()
c = 1
for i in range(len(s)):
  s = s[-1] + s[:-1]
  if s = t:
    c = 0
print('YNeos'[c::2])

### FIXED CODE ###

s = input()
t = input()
c = 1
for i in range(len(s)):
  s = s[-1] + s[:-1]
  if s == t:
    c = 0
print('YNeos'[c::2])
import heapq
import itertools

def dif(l):
  return max(l) - min(l)

x,y,z,k = map(int, input().split())
a = sorted(list(map(int, input().split())), reverse=True)
b = sorted(list(map(int, input().split())), reverse=True)
c = sorted(list(map(int, input().split())), reverse=True)

flag = True
while flag:
  fa = False
  while (x-1)*y*z > k and dif(a) > dif(b) and dif(a) > dif(c):
    a.pop()
    x -= 1
    fa = True

  fb = False
  while x*(y-1)*z > k and dif(b) > dif(a) and dif(b) > dif(c):
    b.pop()
    y -= 1
    fb = True

  fc = False
  while x*y*(z-1) > k and dif(c) > dif(b) and dif(c) > dif(a):
    c.pop()
    z -= 1
    fc = True
  
  flag = fa or fb or fc

l=[]
for a1 in a:
    for b1 in b:
        for c1 in c:
            l.append(a1+b1+c1)

m2 = heapq.nlargest(k, l)
for i in range(k):
  print(m2[i])


### FIXED CODE ###

t = [int(input()) for i in range(6)]
print ("Yay!" if t[4]-t[0] <= t[5] else ":(")
import numpy as np
N = int(input())
a = list(map(int, input().split()))
all_xor = 0
for _a in a:
    all_xor = all_xor ^ _a
for _a in a:
    print(all_xor ^ _a)





### FIXED CODE ###

#import numpy as np
N = int(input())
a = list(map(int, input().split()))
all_xor = 0
for _a in a:
    all_xor = all_xor ^ _a
for _a in a:
    print(all_xor ^ _a)
l = list(input().split())
if l[0] == l[1][::-1]:
  print("YES")
else:
  print("NO")

### FIXED CODE ###

a = input()
b = input()
if a == b[::-1]:
  print("YES")
else:
  print("NO")
import collections
import numpy as np

n=int(input())
x=np.array([int(item) for item in input().split()])
x_sorted=np.sort(x)

for i in range(n):
  if i==0 and x[0]==x[1]:
    print(x_sorted[n//2-1])
  elif i==n-1 and x[n-1]==x[n-2]:
    print(x_sorted[n//2-1])
  elif x[i]==x[i-1] or x[i]==x[i+1]:
    print(x_sorted[n//2-1])
    
  else:
    ind=np.ones(n,dtype=bool)
    ind[np.searchsorted(x_sorted,x[i])]=False
    print(x_sorted[ind][n//2-1])

### FIXED CODE ###

n = int(input())
x = list(map(int,input().split()))
x_sorted = sorted(x)
pin = x_sorted[n//2]
pre = x_sorted[n//2 - 1]
for i in range(n):
  if x[i] < pin:
    print(pin)
  else:
    print(pre)
x,y,a,b,c = map(int,input().split())
print(sum(sorted(sorted(list(map(int,input().split())),reverse=True)[:x]+sorted(list(map(int,input().split())),reverse=True)[:y]+list(map(int,input().split())),reverse=True)[:(x+y)]))

### FIXED CODE ###

s = input()
if s[2]==s[3] and s[4]==s[5]:
  print("Yes")
else:
  print("No")
import std.stdio, std.conv, std.string, std.algorithm;

void main()
{
auto ip = readln.split.to!(int[]);
auto x = 0;
if(ip[0] <= ip[1]){
  x += ip[0];
} else {
  x += ip[0] - 1;
}
  writeln(x);
}

### FIXED CODE ###

a, b = map(int, input().split())
if a <= b:
  print(a)
else:
  print(a-1)
n = int(input())
a = list(map(int, input().split()))
b = dict()
for i in range(n):
    b[i+1] = 0

for i in range(n):
    b[a[i]] += 1

for i in range(n):
    print(b[i+1])

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
b = dict()
for i in range(n):
    b[i+1] = 0

for i in range(n-1):
    b[a[i]] += 1

for i in range(n):
    print(b[i+1])
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<numeric>
#include<cmath>
#include<stdio.h>
//#include<array>

#define rep(i,n) for(int i=0;i<(n);i++)
#define LL long long int


using namespace std;

int main(void){
    LL a,b,c,d;
    cin >> a>>b>>c>>d;

    LL ans=0;
    /* 
    for(int i =a; i<b; i++){

        if(i%c!=0 && i%d!=0){
            ans++;
        }

    }*/

    LL C =b/c-a/c;
      LL D= b/d-a/d;
    /* vector<LL> lista(C);
    int h=0;
    for(LL i =a/c,h=0;i<b/c;h++,i++){
        lista[h]=i*a;
        cout<<lista[h]<< " " << h<< " " << i<< " " << i*a<<endl;
    }
    LL x;
  
    LL j=0;
    LL EX=0;
   for(LL i =a/d;i<b/d;i++){
        x=i*b;
         while(x>lista[j] )j++;
        cout<<x<< " " << lista[j]<< " " << h<< " " << j<<endl;
        if(lista[j]==x)EX++;
        if( h>j)break;

   }*/

    cout <<b-a+1-(C+D)<<endl;
    return 0;
}

### FIXED CODE ###

def gcd(x,y):
    if x<y:
        x,y=y,x
    if y==0:
        return x
    c=x%y
    return gcd(y,c)   
def lcm( x, y):
    return (x*y)//gcd(x,y)
a,b,c,d=map(int,input().split())
C =b//c-(-(-a//c))
D= b//d-(-(-a//d))
EX=  lcm(c,d)
EX=b//EX+(-a//EX)
print(b-a-(C+D)+EX)
N = int(input())
X = input()
Xn = int(X, 2)


def popcount(x):
    '''xの立っているビット数をカウントする関数
    (xは64bit整数)'''

    # 2bitごとの組に分け、立っているビット数を2bitで表現する
    x = x - ((x >> 1) & 0x5555555555555555)

    # 4bit整数に 上位2bit + 下位2bit を計算した値を入れる
    x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)

    x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f  # 8bitごと
    x = x + (x >> 8)  # 16bitごと
    x = x + (x >> 16)  # 32bitごと
    x = x + (x >> 32)  # 64bitごと = 全部の合計
    return x & 0x0000007f


memo = [-1] * (2 * 10 ** 5 + 1)
for i in range(N):
    d = 1 << (N - i - 1)
    if X[i] == '0':
        n = Xn + d
    else:
        n = Xn - d

    cnt = 0
    ni = -1
    while n:
        p = popcount(n)
        n = n % p
        if ni == -1:
            ni = n

        if memo[n] != -1:
            cnt += memo[n]
            break

        cnt += 1

    print(cnt)
    memo[ni] = cnt


### FIXED CODE ###

N = int(input())
X = input()
X_arr = list(X)
N, X = int(N), int(X, 2)
MAX_N = 2 * 10 ** 5


def popcount(x):
    cnt = 0
    for i in range(x.bit_length()):
        if x & 1 << i:
            cnt += 1
    return cnt


memo = [0] * (MAX_N + 1)
for i, n in enumerate(range(1, MAX_N + 1), start=1):
    cnt = 0
    while n:
        p = popcount(n)
        n = n % p
        cnt += 1
    memo[i] = cnt


x_popcount = popcount(X)
p_upper, p_downer = x_popcount + 1, x_popcount - 1
y_upper = X % p_upper
y_downer = X % p_downer if p_downer else None

for i in range(N):
    if X_arr[i] == '0':
        z = (y_upper + pow(2, (N - i - 1), p_upper)) % p_upper
    else:
        if not p_downer:
            print(0)
            continue
        z = (y_downer - pow(2, (N - i - 1), p_downer)) % p_downer

    print(memo[z] + 1)
N, a, b = map(int, input().split())

all = a + b

# a = 0
if a == 0:
    print(0)
    exit(0)

if N <= a:
    print(N)
    exit(0)

# a > 0
c = round(N / all)
d = N % all

roundCnt = a * c

if d != 0:
    if d <= a :
        amariCnt = d
    else:
        amariCnt = a

print(roundCnt + amariCnt)


#a = 0 print 0
#a > 0
# N <= a print N
# N > a
#  N/(a+b)=c     が割り切れる  a * c
#  N/(a+b)=c...d が余りが出る  a * c
#    d <= a のとき a * c + d
#    d >  a のとき a * c + a
#


### FIXED CODE ###

import math
N, a, b = map(int, input().split())

all = a + b

# a = 0
if a == 0:
    print(0)
    exit(0)

if N <= a:
    print(N)
    exit(0)

# a > 0
c = math.floor(N / all)
d = N % all

roundCnt = a * c
amariCnt = 0

if d != 0:
    if d <= a :
        amariCnt = d
    else:
        amariCnt = a

print(roundCnt + amariCnt)


#a = 0 print 0
#a > 0
# N <= a print N
# N > a
#  N/(a+b)=c     が割り切れる  a * c
#  N/(a+b)=c...d が余りが出る  a * c
#    d <= a のとき a * c + d
#    d >  a のとき a * c + a
#
S = input()
A = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"] 
B = [0]*26
flag = -1

for i in range(len(S)):
  
  for j in range(len(A)):
    if S[i] == A[j]:
      B[j] += 1
      break
  
  if i == len(S)
    break

for k in range(B):
  if B[k] == 0
    print(A[k])
    flag = 1
    break
    
if flag == -1:
  print("none")

### FIXED CODE ###

S = input()
A = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"] 
B = [0]*26
flag = -1

for i in range(len(S)):
  
  for j in range(len(A)):
    if S[i] == A[j]:
      B[j] += 1
      break
  
  if i == len(S):
    break

for k in range(len(B)):
  if B[k] == 0:
    print(A[k])
    flag = 1
    break
    
if flag == -1:
  print("None")
a, b, c, d = map(int, input().split())
while a > 0 and c > 0:
  c -= b
  if c > 0:
    a -= d
  else:
    print('Yes')
  if a <= 0
    print('No')


### FIXED CODE ###

s, w = input().split()
if int(w) >=  int(s):
  print('unsafe')
else:
  print('safe')
num = list(map(int, input().split(' ')))
num.sort()
print(' '.join(map(int, num)))


### FIXED CODE ###

num = list(map(int, input().split(' ')))
num.sort()
print(' '.join(map(str, num)))
# -*- coding: utf-8 -*-

date = input().split('/')

if(int(date[0]) >= 2020):
  print('TBD')
  elif(int(date[0]) == 2019 && int(date[1]) >=5):
    print('TBD')
    else:
      print('Heisei')
      
      
  


### FIXED CODE ###

# -*- coding: utf-8 -*-
 
date = input().split('/')
 
if(int(date[0]) >= 2020):
  print('TBD')
elif(int(date[0]) == 2019 and int(date[1]) >=5):
  print('TBD')
else:
  print('Heisei')
n=int(input())
a=0
for i in 100:
  if a<n:
    a=2^(i+1)
print(2^(i-1))

### FIXED CODE ###

n=int(input())
a=0
for i in range(100):
  if a<=n:
    a=2**(i+1)
  else:
    print(2**(i-1))
    exit()
K, X = map(int, input().split())
2 for i in range(X - K + 1, X + K):
3 if i < X + K - 1:
4 print(i, end=' ')
5 else:
6 print(i)


### FIXED CODE ###

a, b = map(int, input().split())
print(max(a+b, a-b,a*b))
314 15
9 26 5 35 8 9 79 3 23 8 46 2 6 43 3

### FIXED CODE ###

N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
if N- sum(A) >= 0:
    print(N- sum(A))
else:
    print('-1')
an = [int(input()) for i in range(5)]
total = 0

for i in range(5):
  tot = (an[i] // 10) * 10
  an[i] -= tot
  total += tot
  if an[i] == 0:
    del an[i]
    
total += min(an) + (len(an) - 1)*10
print(total)

### FIXED CODE ###

li = [int(input()) for i in range(5)]
al = []
ans = 0
for i in li:
  if i % 10 != 0:
    al.append(i % 10) 
  ans += i // 10
ans *= 10
if len(al) > 0:
  ans += min(al) + (len(al) - 1)*10
print(ans)