Given two sequences and . A graph is built with n vertices and n directed edges . Cost to change some is . Your goal is to make the graph strongly connected with minimum cost.
Input
The first line contains an integer n.
The second line contains n intergers, .
The third line contains n integers .
Output
An integer representing the answer.
Constraints
Change to 3 and to 4.