문제
Bessie has woken up on a strange planet. In this planet, there are () months, with days, respectively (, all are integers). In addition, on the planet, there are also weeks, where each week is days, with being a positive integer. Interestingly, Bessie knows the following: For the correct , each month is at least weeks long. For the correct , there are at most distinct values of .
Unfortunately, Bessie has forgotten what is! Help her by printing the sum of all possible values of .
Note that the large size of integers involved in this problem may require the use of 64-bit integer data types (e.g., a "long long" in C/C++).
입력
The first line contains a single integer . The second line contains space-separated integers, .
출력
A single integer, the sum of all possible values of .
예제 입력 1
12
31 28 31 30 31 30 31 31 30 31 30 31
예제 출력 1
28
예제 입력 2
4
31 35 28 29
예제 출력 2
23
점수
Inputs 3-4: Inputs 5-14: No additional constraints
코드를 제출하려면 로그인이 필요합니다.
로그인