PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#GL0000017. Bậc chia hết cho 9 (2 the 9s)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Bậc chia hết cho 9 (2 the 9s)

2 the 9s

Source: UVa

Version: Phuoc Hung OJ Extended

Problem Statement

Given a positive decimal integer NN as a string, determine whether it is divisible by 99. If so, compute its 9-degree: the number of successive digit-sum checks needed to reach a single digit 99, counting N=9N=9 as degree 11.

Input

One line contains positive decimal string NN different from 0.

Output

If divisible, print N is a multiple of 9 and has 9-degree D.; otherwise N is not a multiple of 9..

Subtasks

  • Subtask 1 (20 points): 1≤length⁡(N)≤101 \le \operatorname{length}(N) \le 10
  • Subtask 2 (30 points): 1≤length⁡(N)≤1001 \le \operatorname{length}(N) \le 100
  • Subtask 3 (50 points): 1≤length⁡(N)≤10001 \le \operatorname{length}(N) \le 1000; The string represents a positive decimal integer.

Examples

Input

999

Output

999 is a multiple of 9 and has 9-degree 2.

Explanation

Digit sums are 9+9+9=279+9+9=27 and then 2+7=92+7=9, so the degree is 22.