Bizmarket
InterviewTime limit2sMemory limit1024 MB
Match items to client companies, at most one each, to maximize the sum of (A_i - B_j) over matched pairs, where a pair counts only if A_i is at least B_j.
Problem

Bizmarket is an online general trading company that mainly serves businesses. It runs a welfare mall, corporate promotion and gift business, and industrial goods distribution. Beyond these core areas, it also runs brand, rental, and energy businesses. Its guiding principle is "contributing to the efficiency of client companies' operations and pursuing the welfare of their members." Shinuk was asked by Bizmarket to help run its rental business efficiently.
Bizmarket has items and client companies that want to rent them. Each item has a satisfaction value , and each client company wants to rent an item by paying . Each client company can rent only one item, and each item can be rented to only one client company.
If an item with satisfaction is rented to a client company that pays , the client gains of client satisfaction. Every client company wants to get at least what it pays, so if the client satisfaction would drop below , the company does not go through with the deal. Without a deal, no client satisfaction is gained.
Shinuk's task is to assign items to the client companies so that the total client satisfaction is maximized. He had too many assignments, so he handed this job to you and left. Compute the maximum total client satisfaction on his behalf.
Input
The first line contains the integers and , separated by a space.
The second line contains integers , separated by spaces.
The third line contains integers , separated by spaces.
Output
On the first line, print the maximum total client satisfaction that can be obtained by choosing an item for each client company.
Hint
The answer can exceed the int range, so you must use a 64-bit integer type (C/C++: long long, Java: long).