Cowlendar
시간 제한2초메모리 제한1024 MB
각 달이 적어도 4주이고 달 길이 N개의 L에 대한 나머지가 많아야 3가지인 양의 정수 L을 모두 찾아 합을 구한다.
문제
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 .