The Archaeological Institute discovered an ancient civilization that used a unique method to preserve important texts. The scribes would encode manuscripts using numerical symbols (0–255), then split each scroll into two equal fragments. To both fragments, they added a special marker symbol at corresponding positions: a number not present elsewhere in the original text. This marker served as an alignment guide. Afterwards, each fragment was rotated differently: one clockwise and the other counterclockwise by the same number of positions.
A renowned archaeologist recently found two numerical sequences of equal length in a tomb. It is suspected these may be fragments of the same ancient scroll. To check this, both sequences must be restored to their original alignment, so that the marker symbols appear in the same positions. This is done by rotating both sequences by an equal number of positions: the first sequence counterclockwise and the second clockwise. If, after this operation, all marker symbols align at the same positions, the fragments belong to the same scroll. If such an alignment cannot be achieved, they are from different scrolls.
Help determine the minimum number of positions needed to rotate the fragments to restore the original scroll.
The first line contains the integer (1 \le N \le 200000) — the length of each fragment.
The second and third lines each contain integers representing the two fragments found in the tomb.
The last line contains a single integer — the marker symbol .
All numbers are integers between and , inclusive.
Print a single integer — the minimum rotation required to align the fragments and restore the original scroll. If the fragments are from different scrolls, print .
Example 1