eolymp
bolt
Try our new interface for solving problems
Problems

Matches

Matches

We can make digits with matches as shown below: \includegraphics{https://static.e-olymp.com/content/26/2643aa8b2c3d93f3282a978e017ed2e84cf2a85f.jpg} Given \textbf{N} matches, find the number of different numbers representable using the matches. We shall only make numbers greater than or equal to \textbf{0}, so no negative signs should be used. For instance, if you have \textbf{3} matches, then you can only make the numbers \textbf{1} or \textbf{7}. If you have \textbf{4} matches, then you can make the numbers \textbf{1}, \textbf{4}, \textbf{7} or \textbf{11}. Note that leading zeros are not allowed (e.g. \textbf{001}, \textbf{042}, etc. are illegal). Numbers such as \textbf{0}, \textbf{20}, \textbf{101} etc. are permitted, though. \InputFile Input contains no more than \textbf{100} lines. Each line contains one integer \textbf{N} (\textbf{1} ≤ \textbf{N} ≤ \textbf{2000}). \OutputFile For each \textbf{N}, output the number of different (non-negative) numbers representable if you have \textbf{N} matches.
Time limit 1 second
Memory limit 64 MiB
Input example #1
3
4
Output example #1
2
4