190A.md (2307B)
1 Source: https://codeforces.com/problemset/problem/190/A 2 3 A. Vasya and the Bus 4 5 time limit per test 6 7 2 seconds 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 stdin 16 17 output 18 19 stdout 20 21 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..." 22 23 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. 24 25 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. 26 27 We know that in High Bertown children can't ride in a bus unaccompanied by grown-ups. 28 29 Help Vasya count the minimum and the maximum sum in Berland rubles, that all passengers of this bus could have paid in total. 30 31 Input 32 33 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. 34 35 Output 36 37 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. 38 39 Otherwise, print "Impossible" (without the quotes). 40 41 Examples 42 43 Input 44 45 ``` 46 1 2 47 ``` 48 49 Output 50 51 ``` 52 2 2 53 ``` 54 55 Input 56 57 ``` 58 0 5 59 ``` 60 61 Output 62 63 ``` 64 Impossible 65 ``` 66 67 Input 68 69 ``` 70 2 2 71 ``` 72 73 Output 74 75 ``` 76 2 3 77 ``` 78 79 Note 80 81 In the first sample a grown-up rides with two children and pays two rubles. 82 83 In the second sample there are only children in the bus, so the situation is impossible. 84 85 In the third sample there are two cases:* 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. 86 * 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.