#P1473F. Strange Set
Strange Set
Description
Note that the memory limit is unusual.
You are given an integer and two sequences and .
Let's call a set of integers such that strange, if, for every element of , the following condition is met: for every , if divides , then is also included in . An empty set is always strange.
The cost of the set is . You have to calculate the maximum possible cost of a strange set.
The first line contains one integer ().
The second line contains integers ().
The third line contains integers ().
Print one integer — the maximum cost of a strange set.
Input
The first line contains one integer ().
The second line contains integers ().
The third line contains integers ().
Output
Print one integer — the maximum cost of a strange set.
Note
The strange set with the maximum cost in the first example is .
The strange set with the maximum cost in the second example is empty.