Under construction

Still being built. Things may change

Boris and Berta

Interview

Time limit2sMemory limit512 MB

Summary
Given a target distance n and lengths m and c, find non-negative counts of miles and cables whose total length is as close to n as possible.
Level

Medium4 of 10

Topics
Math, Number theory, Brute force, Implementation
Solved
No attempts yet

Problem

Boris is making a quest for his sister Berta. One of the tasks is to find a point on the map that is nn meters north of their house. But it is too easy if nn is given directly. Boris decided to specify the distance using miles and cables.

He found out that miles vary a lot: from a 500500-meter Chinese mile (called li) up to an 11 29911\,299-meter Norwegian mile (called mil). A cable length can be anywhere from 169169 to 220220 meters.

Boris decided to use an mm-meter mile and a cc-meter cable. Now he wants to write the nn-meter distance as "MM miles and CC cables" with non-negative integers MM and CC as precisely as possible, that is, he wants to minimize ∣M⋅m+C⋅c−n∣|M\cdot m+C\cdot c-n|. Help him!

Input

Three lines contain an integer each: nn, the distance to represent, mm, the chosen length of a mile, and cc, the chosen length of a cable (1≤n≤1091 \le n \le 10^9; 500≤m≤11 299500 \le m \le 11\,299; 169≤c≤220169 \le c \le 220). All values are given in meters.

Output

Print two non-negative integers MM and CC, the best approximation of the distance of nn meters using the chosen mile and cable lengths. If there are multiple best approximations, print any of them.

Hint

The second example test has two correct answers: "1 6" and "3 1".

Examples2

  1. Example 1

    Input
    1234
    500
    169
    
    Expected output
    0 7
    
  2. Example 2

    Input
    1700
    500
    200
    
    Expected output
    1 6