35 lines
713 B
Python
35 lines
713 B
Python
LOOP_COUNT = 1_000_000
|
|
EXPECTED_CHECKSUM = 3_875_007
|
|
|
|
|
|
def configured_loop_count() -> int:
|
|
try:
|
|
value = int(input().strip())
|
|
except (EOFError, ValueError):
|
|
return LOOP_COUNT
|
|
|
|
return value if value > 0 else LOOP_COUNT
|
|
|
|
|
|
def vec_i32_index_loop(limit: int) -> int:
|
|
digits = [3, 1, 4, 1, 5, 9, 2, 6]
|
|
i = 0
|
|
acc = 7
|
|
|
|
while i < limit:
|
|
acc += digits[i % len(digits)]
|
|
acc = acc - 1_000_000_000 if acc > 1_000_000_000 else acc
|
|
i += 1
|
|
|
|
return acc
|
|
|
|
|
|
def main() -> int:
|
|
result = vec_i32_index_loop(configured_loop_count())
|
|
print(result)
|
|
return 0 if result == EXPECTED_CHECKSUM else 1
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|