Time train

Michelangelo has attended the 75 AD gladiator fights at the Colosseum and now wants to travel back to his own time in 1505 AD. He decides to take the time train at the Termini station.

Instead of stopping at different stations, the time train stops at the same station, but at different times. Specifically, the regular time train stops every minute at the Termini station. Every minute there are also express trains that only stop every three minutes.

Since Michelangelo has been taking math lessons by his good friend Leonardo, he starts thinking about the number of different ways in which he can travel home. For example, if he has to travel a total of 5 minutes, there are 4 ways of going home:

Input

The input consists of several test cases. Each test case consists of a number of minutes nn such that 1n10000000000001\leq n\leq 1000000000000.

Output

For each test case, compute the number of ways in which Michelangelo can travel home. Since this number can be very large, output the number modulo 1000003.

Problem information

Author: Anders Jonsson

Generation: 2026-01-25T22:06:22.071Z

© Jutge.org, 2006–2026.
https://jutge.org