# 競程三 -- 110550126 -- problem2 ## Problem Description Joe is a guy, who want to explore the myth of the world. One day he discover a tunnel to get in to Atlantis. In the tunnel there are two roads with blocks, for every blocks there is a score, for two roads the score of blocks are strictly increasing. Everytime get into a new block he can choose to grab the score or teleport to the block at the other road with same score. To get in to the Atlantis Joe should get as many as score, please help Joe to caculate the maximun score that he can get. ## input format The first line contains two number $n$, $m$ — denoted the number of blocks in first road and the number of blocks in second road. The next line contains $n$ integers $n_1, n_2, \ldots, n_n$ — $n_i$ is the score of $i$th block in road1 $i$. The next line contains $m$ integers $m_1, m_2, \ldots, m_m$ — $m_i$ is the score of $i$th block in road2 $i$. ## output format Output an integer, which is the maximun score of Joe can get, since the number can be very large please module $1\,000\,000\, 007$. ## Technical Specification - $1 \le n,m \le 100\,000$ - $0 \le n_i , m_i \le 10\,000\,000$ ## Sample IO ``` === Input1 === 5 6 3 4 6 9 10 1 3 7 10 11 12 === Output1 === 56 === Explain1 === nums1: 3->4->6->9->10 ^ | | ˇ nums2:1->3 10 11 12 // 3 and 10 only grab one time, since the first time are used to teleport ``` ``` === Input2 === 7 6 5 7 9 10 17 20 25 3 6 7 18 19 20 === Output2 === 98 === Explain2 === nums1: 20 -> 25 ^ | nums2:3->6->7->18->19->20 // 20 only grab one time, since the first time are used to teleport ```