A junior college in Singapore just acquired a sailing boat, and the school's student sailing team undertakes to paint the boat. There are several painting jobs to be done on the boat, such as:
The first line of the input contains one integer, n, ranging from 2 to 20000, which specifies the number of painting jobs. We identify the jobs by numbers, ranging from job 1 to job n, regardless of when they are executed.
The following line contains n numbers, each ranging from 1 to 1000. The ith number in this line specifies the price for the paint for job i.
The last line contains n numbers, each ranging from 0 to 10. The jth number in this line specifies the amount of money by which the price for the paint for job j increases every day.
The required output, to be written to standard output, consists of a single number, specifying the smallest amount of money sufficient to complete all jobs.
2 <= N <= 20 000
7 100 200 500 300 400 200 100 5 2 0 5 7 1 3
1837
Subtask | Score |
---|---|
1 | 100 |
2 | 0 |