#BS0000010. Tổng chính xác (Exact Sum)
Tổng chính xác (Exact Sum)
Exact Sum
Source: UVa
Version: Phuoc Hung OJ Extended
Problem Statement
Peter has exactly money and wants to buy exactly two different books.
There are books with prices . Choose two books with prices such that:
If several pairs are possible, choose the pair minimizing:
A valid pair is guaranteed to exist.
Input
The first line contains .
The second line contains the book prices.
The third line contains .
Output
Print exactly:
Peter should buy books whose prices are a and b.
Print a blank line after the answer.
Subtasks
- Subtask 1 — 20%: .
- Subtask 2 — 30%: .
- Subtask 3 — 50%: , every book price is less than ; a solution always exists.
Examples
Input
5
10 2 6 8 4
10
Output
Peter should buy books whose prices are 4 and 6.
Explanation
Both and sum to , but is smaller than .