In the set of numbers
N
, replace one number with a number from the set of numbers
M
so that the sum of the numbers in the set
N
is as close as possible to the number < code>S. Print three numbers, each on a separate line:
1 line - the number that was replaced from the set
N
;
2nd line - the number from the set
M
, which was replaced;
Line 3 - the resulting sum of numbers from the set
N
.
It is guaranteed that such a substitution can be made. If possible substitutions several, then choose the one in which the number from the
N
set is less.
Input
In the first line, enter 3 numbers separated by a space:
n
(10<=N<=10
5) - the number of numbers in the set
N
, < code>m (10<=M<=10
5) - number of numbers in set
M
,
S
( 10<=S<=10
9)
S>sum(N)
, where
sum(N)
is the sum of all numbers in the set < code>N.
The second line contains a set of numbers
N
:
n
numbers separated by one space (each number modulo does not exceed 10
5).
The third line contains a set of numbers
M
:
m
numbers separated by one space (each number modulo does not exceed 10
5).
Imprint
Display the answer to the problem as specified in the condition.
Examples
# |
Input |
Output |
1 |
2 2 10
24
1 3
| 2
3
7 |