An Angular Puzzle

Here is an old interesting puzzle: In the picture below, what is the angle of DEA, in degrees? Note that 5 angles are already given. The picture is drawn to scale. You’re to solve a generalized problem: let a, b, c, d, e be the angle of ACB, CAE, EAB, CBD, DBA (in degrees), what is the angle of DEA, in degrees? Note that E must be strictly on segment BC (cannot coincide with B or C), and D must be strictly on segment AC (cannot co- incide with A or C). The triangle ABC must be non-degenerated (i.e. ABC cannot be collinear). Not all combination of parame- ters a, b, c, d and e corresponds to a valid figure described above. Your program should be able to detect this. Input There will be at most 100 test cases. Each case contains 5 integers a, b, c, d, e (0 < a,b,c,d,e < 90). The last test case is followed by five zeros, which should not be processed. Output For each test case, print the answer to two decimal places. If there is more than one solution, print ‘Multiple solutions’. If the input is incorrect (i.e. there is no valid picture for these parameters), print ‘Impossible’ (without quotes). Sample Input 20 10 70 20 60 30 5 70 15 60 60 30 30 30 30 30 40 40 40 40 00000 Sample Output 20.00 12.96 30.00 Impossible