unittest
{
	assert( [ "8 3 4" ].parse.expand.solve == 4 );
	assert( [ "8 0 4" ].parse.expand.solve == 0 );
	assert( [ "6 2 4" ].parse.expand.solve == 2 );
}



import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto nab = input.front.split.to!( long[] );
	return tuple( nab[ 0 ], nab[ 1 ], nab[ 2 ] );
}

auto solve( long n, long a, long b )
{
	auto g = ( a + b );
	auto c = n / g;
	auto r = n % g;
	return a * c + min( a, r );
}
