Note: This problem is an easier version of the POI problem Bank Notes from 2005.
The Byteotian Bit Bank (BBB) has the largest network of cash dispensers in the whole Byteotia. The BBB have decided to improve their dispensers and have asked you for help. The legal tender in Byteotia are bank notes of denominations . The BBB have concluded that the cash dispensers are to pay every sum in the smallest possible total number of notes.
Write a programme that:
- reads from the standard input the description of the dispenser's notes stock and the sum to be paid off,
- determines the minimal total number of bank notes sufficient to pay the desired sum off,
- writes the result to the standard output.
In the first line of the standard input the number of denominations is written , . The second line contains integers , separated by a single space. The third line contains integers , also separated by a single space; is the number of bank notes of denomination left in the cash dispenser. In the last, fourth line of input there is one integer - the sum to be paid off. For the test data, you are free to assume that the sum can be paid off in the available bank notes.
The standard output should contain one integer denoting the minimal total number of bank notes sufficient to pay the sum off .
3 2 3 5 2 2 1 10