IPSC Logo

Internet Problem Solving Contest

IPSC 2011
Sample Problem Q - Quality of Service

Quality of Service

For technical reasons, this problem statement is only available online. Sorry for the inconvenience.

The example input and output is available, though:

Example

input
3

1

2

47
output
2

47

42