I. LIS Decrement
time limit per test
2 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Examples
Input
5
1 3 2 5 4
100 2 4 6 5
Output
111
Input
7
7 3 2 1 5 2 1
4 8 4 1 2 3 5
Output
24
Input
4
1 1 1 1
4 5 1 7
Output
0