Logo
(追記) (追記ここまで)

19058번 - Anna and Lucky Tickets 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 256 MB33191372.222%

문제

Anna is a very diligent student. That is why she attends all classes in the university. Every morning she gets on the bus and, applying E-card to a special device, gets a ticket with an $n$-digit decimal number on it (possibly with leading zeros).

To entertain herself during the trip, Anna checks if the ticket is lucky. She knows two methods of verification. According to the first method, the ticket is lucky if the sum of the digits standing on even positions is equal to the sum of the digits standing on odd positions (the positions are numbered from left to right starting from one). According to the second method, the ticket is lucky if the sum of the first $\left\lfloor n / 2 \right\rfloor$ digits is equal to the sum of the last $\left\lfloor n / 2 \right\rfloor$ digits (in particular, if the length of the ticket number is odd, then the middle digit is not taken into account).

If the ticket is lucky according to both methods, then Anna is frightened that everything goes too well, and calls such ticket unlucky. Of course, if the ticket is not lucky in any of the ways, it is also called unlucky.

Anna gets very angry when she sees an unlucky ticket whose number is a palindrome (that is, the number stays the same if we read it from right to left instead of from left to right). Help us calculate the number of such tickets! Oh, yes, there can be a lot of them, so output this number modulo 10ドル^9 + 7$.

입력

A single line of input contains an integer $n,ドル the length of the ticket number (2ドル \le n \le 10^6$).

출력

Output an integer: the number of $n$-digit unlucky tickets whose numbers are palindromes, taken modulo 10ドル^9 + 7$.

제한

예제 입력 1

3

예제 출력 1

5

힌트

출처

Camp > Petrozavodsk Programming Camp > Summer 2017 > Day 3: Ural Contest D번

Contest > Open Cup > 2017/2018 Season > Stage 2: Grand Prix of Ural D번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /