Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/for-tangalar-bilan-tolash

Paying with coins

Medium 1000 ms 64 MB 48%
Share

A positive integer $N$ is given. Determine in how many ways exactly $N$ soums can be paid with coins of $1$, $2$ and $5$ soums (the order of the coins does not matter):

$$5 * x + 2 * y + z = N, \qquad x, y, z \ge 0$$

Paying a sum with a combination of coins

Input

One positive integer $N$.

Output

One integer — the number of ways.

Note

$1 \le N \le 1000$

Examples

Input #1
7
Output #1
6
Input #2
10
Output #2
10

Sign in to submit a solution

Signing up is free and takes a minute.