module countball
  sub Main(ByVal args() as String)
    dim arr(3) as string
    arr=Split(Console.ReadLine())
    dim a,b,c,n,x as integer

    a=arr(0)
    b=arr(1)
    c=arr(2)

n=0

while a>0

if a>=b then
a=a-b
n=n+b
elseif a>0 then
n=n+a
a=0
end if

if a>=c then
a=a-c
elseif a>0 then
a=0
end if

end while

Console.WriteLine(n)

end sub
end module