{"problem":{"name":"Glass and Mug","description":{"content":"AtCoder Inc. sells [glasses](https://suzuri.jp/AtCoder/5510290/water-glass/m/clear) and [mugs](https://suzuri.jp/AtCoder/5510290/mug/m/white). Takahashi has a glass with a capacity of $G$ milliliters ","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc332_b"},"statements":[{"statement_type":"Markdown","content":"AtCoder Inc. sells [glasses](https://suzuri.jp/AtCoder/5510290/water-glass/m/clear) and [mugs](https://suzuri.jp/AtCoder/5510290/mug/m/white).\nTakahashi has a glass with a capacity of $G$ milliliters and a mug with a capacity of $M$ milliliters.  \nHere, $G<M$.\nInitially, both the glass and the mug are empty.  \nAfter performing the following operation $K$ times, determine how many milliliters of water are in the glass and the mug, respectively.\n\n*   When the glass is filled with water, that is, the glass contains exactly $G$ milliliters of water, discard all the water from the glass.\n*   Otherwise, if the mug is empty, fill the mug with water.\n*   Otherwise, transfer water from the mug to the glass until the mug is empty or the glass is filled with water.\n\n## Constraints\n\n*   $1\\leq K\\leq 100$\n*   $1\\leq G<M\\leq 1000$\n*   $G$, $M$, and $K$ are integers.\n\n## Input\n\nThe input is given from Standard Input in the following format:\n\n$K$ $G$ $M$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc332_b","tags":[],"sample_group":[["5 300 500","200 500\n\nThe operation will be performed as follows. Initially, both the glass and the mug are empty.\n\n*   Fill the mug with water. The glass has $0$ milliliters, and the mug has $500$ milliliters of water.\n*   Transfer water from the mug to the glass until the glass is filled. The glass has $300$ milliliters, and the mug has $200$ milliliters of water.\n*   Discard all the water from the glass. The glass has $0$ milliliters, and the mug has $200$ milliliters of water.\n*   Transfer water from the mug to the glass until the mug is empty. The glass has $200$ milliliters, and the mug has $0$ milliliters of water.\n*   Fill the mug with water. The glass has $200$ milliliters, and the mug has $500$ milliliters of water.\n\nThus, after five operations, the glass has $200$ milliliters, and the mug has $500$ milliliters of water. Hence, print $200$ and $500$ in this order, separated by a space."],["5 100 200","0 0"]],"created_at":"2026-03-03 11:01:13"}}