[Community Puzzle] The leaking bathtub

The following custom cases may help those who fail Validator 3 to debug:

(1)
Input:

10700
125
36
15
124 2
11 3
76 1
32 4
83 1
115 5
32 4
50 2
31 2
40 5
14 2
92 2
42 4
47 5
70 1

Output:

Impossible, 92 cm.

(2)
Input:

11200
109
37
15
32 5
60 1
100 4
36 3
25 6
104 4
69 6
33 2
47 2
55 5
6 4
10 4
32 1
62 4
79 6

Output:

Impossible, 62 cm.
2 Likes