One of the key elements to hold a successful programming contest is maximizing the overall satisfaction degree of all participating teams. Although a team's satisfaction degree is influenced by many factors -- for example, whether this competition is well-organized, and sometimes the weather condition of the place where the competition is held - but among those factors, what usually influences a team's satisfaction degree most is the team's performance in the contest.
Since the performance factor is a matter which the organizing committee cannot control, ask you to simply estimate the overall satisfaction degree of all teams. In particular, through years of experience, the committee asks you to calculate the satisfaction degree of a team using the following estimation steps:
1. If this team has performed in the contest at least as well as it had expected, its satisfaction degree is 3; otherwise
2. If this team's performance is better than its last year's performance, its satisfaction degree is 2; otherwise its satisfaction degree is 1.
(For the sake of simplicity, both the performance of a team and a team's expectation are measured by its place on the rank list.)
This year's and last year's rank lists, along with the expectations of all teams are already given to you. (But the method which we used to find the expectations of the participating teams will remain a secret!) Can you calculate the total satisfaction degree of all teams by the above rules and the data you've been given?