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

31660번 - Mirror Strings 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB34312589.286%

문제

A character is called a “mirror character” if it looks the same when flipped up and down, and the same when flipped left and right. The uppercase mirror characters, H, I, O, X. The lowercase mirror characters are l (since people often write this as a vertical line), o, and x.

In the same way, a string that looks the same when flipped up and down or when flipped left and right is called a “mirror string”. For example, XXOOOOXX is a mirror string.

The height of the character affects the construction of the mirror string. For example, llll and oooo are both mirror strings. However, lool is not a mirror string because it looks different when it is flipped up and down. The uppercase characters H, I, O, X and the lowercase character l are both of height 2ドル$ while the lowercase letters x and o are of height 1.

Tommy wants to construct mirror strings with lower characters and upper characters. He wants to know how many different mirror strings have length in the range $[L, R]$ (i.e. how many mirror strings have a length $m$ satisfying $L \leq m \leq R$).

For example, the 7ドル$ mirror strings of length 1ドル$ are H, I, O, X, l, o, or x. There are also 7ドル$ mirror strings of length 2ドル,ドル namely HH, II, OO, XX, ll, oo, and xx. But there are many more mirror strings of bigger lengths, for example there are 29ドル$ mirror strings of length 3ドル$.

입력

The first and only line of input contains two integers $L$ and $R$ (1ドル \leq L \leq R \leq 10^6$), indicating the range of the lengths of mirror strings that Tommy wants to count.

출력

Output the number of mirror strings that have a length $m$ satisfing $L \leq m \leq R$. Since there can be many such strings, you should output the answer modulo 10ドル^9 + 7$ (i.e. the remainder of the answer when it is divided by 10ドル^9 + 7$).

제한

예제 입력 1

1 4

예제 출력 1

72

예제 입력 2

2 3

예제 출력 2

36

예제 입력 3

2 1000000

예제 출력 3

664868576

힌트

출처

University > University of Alberta Programming Contest > UAPC 2023 > Division 1 F번

University > University of Alberta Programming Contest > UAPC 2023 > Division 2 F번

  • 문제를 만든 사람: Answer
(追記) (追記ここまで)

출처

대학교 대회

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

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