Problem:
Score : 200 points

Problem Statement

Takahashi has many red balls and blue balls. Now, he will place them in a row.

Initially, there is no ball placed.

Takahashi, who is very patient, will do the following operation 10^{100} times:

Place A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.

How many blue balls will be there among the first N balls in the row of balls made this way?

Constraints

1 \leq N \leq 10^{18}

A, B \geq 0

0 < A + B \leq 10^{18}

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N A B

Output

Print the number of blue balls that will be there among the first N balls in the row of balls.

Sample Input 1

8 3 4

Sample Output 1

4

Let b denote a blue ball, and r denote a red ball. The first eight balls in the row will be bbbrrrrb, among which there are four blue balls.

Sample Input 2

8 0 4

Sample Output 2

0

He placed only red balls from the beginning.

Sample Input 3

6 2 4

Sample Output 3

2

Among bbrrrr, there are two blue balls.

Solution in C# (Mono 4.6.2.0) (judge verdict: Wrong Answer)

/**
 * code generated by RHelper
 * More info: https://github.com/mkc1370/RHelper
 * @author 
 */

using System;

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;

public class BCountBalls
{
    private readonly StringReader cin;
    private readonly StringWriter cout;
    private readonly Scanner scanner;

    public BCountBalls(StringReader cin, StringWriter cout)
    {
        this.cin = cin;
        this.cout = cout;
        scanner = new Scanner(cin);
    }

    public void Solve()
    {
        var n = CINL;
        var a = CINL;
        var b = CINL;
        cout.WriteLine(n/(a+b)*a+Math.Max(0, n%(a+b)));
    }

    private long CINL => scanner.Long();
    private double CIND => scanner.Double();
    private string CINS => scanner.Scan();
    private static IEnumerable<T> Repeat<T>(T v, long n) => Enumerable.Repeat(v, (int)n);
    private long[] CINVL(long n) => Repeat(0, n).Select(_ => CINL).ToArray();
    private double[] CINVD(long n) => Repeat(0, n).Select(_ => CIND).ToArray();
    private string[] CINVS(long n) => Repeat(0, n).Select(_ => CINS).ToArray();
}

public class Scanner
{
    public Scanner(StringReader stringReader)
    {
        this.stringReader = stringReader;
    }

    private readonly StringReader stringReader;
    private readonly char[] buffer = new char[1024];
    private int len, ptr;
    private bool isEof;

    private char Read()
    {
        if (isEof) throw new EndOfStreamException();
        if (ptr >= len)
        {
            ptr = 0;
            if ((len = stringReader.Read(buffer, 0, 1024)) <= 0)
            {
                isEof = true;
                return '\0';
            }
        }

        return buffer[ptr++];
    }

    public char Char()
    {
        char b;
        do b = Read();
        while (b < 33 || 126 < b);
        return b;
    }

    public string Scan()
    {
        var sb = new StringBuilder();
        for (char b = Char(); b >= 33 && b <= 126; b = (char) Read())
            sb.Append(b);
        return sb.ToString();
    }

    public long Long()
    {
        long ret = 0;
        char b;
        var ng = false;
        do b = Read();
        while (b != '-' && (b < '0' || '9' < b));
        if (b == '-')
        {
            ng = true;
            b = Read();
        }

        for (;; b = Read())
        {
            if (b < '0' || '9' < b)
                return ng ? -ret : ret;
            else ret = ret * 10 + b - '0';
        }
    }

    public double Double()
    {
        return double.Parse(Scan(), CultureInfo.InvariantCulture);
    }
}


public class Output
{
	public static void Main()
	{
		var reader = new System.IO.StringReader(Console.In.ReadToEnd());
		var writer = new System.IO.StringWriter();
		var solver = new BCountBalls(reader, writer);
		solver.Solve();
		Console.Write(writer.GetStringBuilder().ToString());
	}
}