
Domagoj is in the big city of London! Right now, there is a sequence of tall skyscrapers in front of him and he wants to take a photograph to remember the moment.
The sequence of skyscrapers can be represented as a sequence of
Domagoj has a strange sense of beauty of a photograph. He is very happy when there are tall skyscrapers
in the photograph, but he is even happier when their heights have a large common divisor! If we label the
heights of the contiguous skyscrapers on the photograph with
Help Domagoj determine the beauty of the most beautiful photograph with at least
Input Specification
The first line contains two integers
The second line contains
Output Specification
Print a single line with the required number from the task.
Constraints
Subtask | Points | Constraints |
---|---|---|
No additional constraints. |
Sample Input 1
6 2
2 1 4 4 4 2
Sample Output 1
48
Explanation for Sample Output 1
Domagoj photographed skyscrapers
Sample Input 2
4 1
7 3 9 4
Sample Output 2
81
Explanation for Sample Output 2
Domagoj photographed only the skyscraper
Comments