Codeforces Round 120 (Div. 2)
A
Vasya and the Bus
Codeforces
1100
原题
←B →
翻译中…

One day Vasya heard a story: "In the city of High Bertown a bus number 62 left from the bus station. It had $*n*$ grown-ups and $*m*$ kids..."

翻译中…

The latter events happen to be of no importance to us. Vasya is an accountant and he loves counting money. So he wondered what maximum and minimum sum of money these passengers could have paid for the ride.

翻译中…

The bus fare equals one berland ruble in High Bertown. However, not everything is that easy — no more than one child can ride for free with each grown-up passenger. That means that a grown-up passenger who rides with his $*k*$ $(*k* > 0)$ children, pays overall $*k*$ rubles: a ticket for himself and $(*k* - 1)$ tickets for his children. Also, a grown-up can ride without children, in this case he only pays one ruble.

翻译中…

We know that in High Bertown children can't ride in a bus unaccompanied by grown-ups.

翻译中…

Help Vasya count the minimum and the maximum sum in Berland rubles, that all passengers of this bus could have paid in total.

翻译中…

Input

翻译中…

The input file consists of a single line containing two space-separated numbers $*n*$ and $*m*$ $(0 ≤ *n*, *m* ≤ 10^{5})$ — the number of the grown-ups and the number of the children in the bus, correspondingly.

翻译中…

Output

翻译中…

If $*n*$ grown-ups and $*m*$ children could have ridden in the bus, then print on a single line two space-separated integers — the minimum and the maximum possible total bus fare, correspondingly.

翻译中…

Otherwise, print "Impossible" (without the quotes).

翻译中…

Note

翻译中…

In the first sample a grown-up rides with two children and pays two rubles.

翻译中…

In the second sample there are only children in the bus, so the situation is impossible.

翻译中…
  • Each of the two grown-ups rides with one children and pays one ruble for the tickets. In this case the passengers pay two rubles in total.
  • One of the grown-ups ride with two children's and pays two rubles, the another one rides alone and pays one ruble for himself. So, they pay three rubles in total.
翻译中…

样例

Input #1
1 2
Output #1
2 2
InputCopy OutputCopy
Input #2
0 5
Output #2
Impossible
InputCopy OutputCopy
Input #3
2 2
Output #3
2 3
InputCopy OutputCopy
题目信息
题号
190A
时间限制
2 s
内存限制
256 MB
标签
贪心
数学

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。