您的位置:首页 > 其它

Vasya and the Bus

2013-12-22 22:33 357 查看
Description

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 ≤ 105) — 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).

Sample Input

Input

1 2

Output

2 2

Input

0 5

Output

Impossible

Input

2 2

Output
2 3

#include<stdio.h>
int main()
{
int m,n,max,min;
while(~scanf("%d%d",&n,&m))
{
if(n==0)
{
if(m==0)
{printf("0 0\n");}
else
{printf("Impossible\n");}
continue;
}
else if(n<=m)
{max=m+n-1; min=m;}
else if(m==0)
{max=n;min=n;}
else
{max=m+n-1;min=n;}
printf("%d %d\n",min,max);
}
return 0;
}

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: