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

#GL0000037. Đếm số lần trừ để hai số bằng nhau (Count Subtractions)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Đếm số lần trừ để hai số bằng nhau (Count Subtractions)

Count Subtractions

Source: AtCoder

Version: Phuoc Hung OJ Extended

Problem Statement

Given positive integers A,BA,B, repeatedly subtract the smaller one from the larger one until A=BA=B. Count the number of subtractions until the two values become equal.

Input

One line contains A,BA,B.

Output

Print the number of subtractions.

Subtasks

  • Subtask 1 (20 points): 1≤A,B≤1001 \le A,B \le 100
  • Subtask 2 (30 points): 1≤A,B≤1061 \le A,B \le 10^{6}
  • Subtask 3 (50 points): 1≤A,B≤10181 \le A,B \le 10^{18}

Examples

Input

3 8

Output

4

Explanation

The states are (3,8)→(3,5)→(3,2)→(1,2)→(1,1)(3,8)\to(3,5)\to(3,2)\to(1,2)\to(1,1): exactly four subtractions.