• + 0 comments

    Input (stdin) 5 3 1 1 500 2 5 100 3 4 100 Your Output (stdout) 500 I HAVE TESTED IT