Dragons
In ancient times, when dragons were not legends, to tame a dragon, one had to engage in a mental battle with it! When Chmyyyaks was taming his dragon, he gave it the following task. He solved it very quickly, but can you?
Two arrays of length are given. Let us define a good pair of subsegments of different arrays — a subsegment of the first array (denoted as ) and — a subsegment of the second array (denoted as ), satisfying the following properties:
— they have the same length.
, where
In short, your task is simple — count the number of good pairs of subsegments.
Input
The first line contains exactly one integer — the length of two arrays.
The second line contains integers — the elements of the first array.
The third line contains integers — the elements of the second array.
Output
Output only one integer – the answer to the problem.
Examples
Note
In the first sample
a pair of subsegments is bad, cause ;
a pair of subsegments is good, because .
In total there are 4 good pairs of subsegments: .
Scoring
( points): ;
( points): ;
( points): ;
( points):
( points): no additional constraints;