Scoreboard#606

Scoreboard

2 seconds
64 megabytes
Easy

In a medieval city, it was decided to install a special display on the main square to show the current year. Since there were no computers in the Middle Ages, this display was made of stone.

The display has four digits, allowing any year up to to be shown. To ensure that the residents of the city could easily see the current year, the digits were made large and heavy.

This display was not electronic; the digits had to be changed manually using rather primitive mechanical devices. These devices consisted of various blocks and levers, mysteriously interconnected. Each device was designed for changing exactly one digit, and was so fragile that it immediately broke after use.

As the city's chief sage and astrologer, your task is to calculate how many such devices are needed for the display to operate properly if it is to be used from year to year inclusive.

Input

The input file contains an integer (1000 \le n \le 9999).

Output

Output the answer to the problem in the output file.

Examples

Example 1

Loading
Loading