#CCBCHMOT0000035. Số giảm đến khi chạm 0 (Decrementing to Zero)

Số giảm đến khi chạm 0 (Decrementing to Zero)

Decrementing to Zero

Source: Phước Hưng OJ

Version: Phuoc Hung OJ Extended

Problem Statement

Start from nonnegative x. At each step let d be the last decimal digit. If d>0, subtract d; otherwise subtract 1. Count steps until x first reaches zero. Starting at zero requires zero steps.

Input

One integer x.

Output

Print the number of operations.

Subtasks

  • Subtask 1 (20%): 0≤x≤1000\le x\le100.
  • Subtask 2 (30%): 0≤x≤1040\le x\le10^4.
  • Subtask 3 (50%): 0≤x≤1060\le x\le10^6.

Examples

Example 1

Input

21

Output

5

Explanation

The states are 21,20,19,10,9,0: five operations.

Example 2

Input

0

Output

0

Explanation

Zero already satisfies the stopping condition.