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

#GL0000020. Đếm cặp phần nguyên bằng phần dư (Floor and Mod)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Đếm cặp phần nguyên bằng phần dư (Floor and Mod)

Floor and Mod

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

An ordered positive-integer pair (a,b)(a,b) is special when ⌊a/b⌋=a mod b\lfloor a/b\rfloor=a\bmod b. Given bounds x,yx,y, count special pairs with 1≤a≤x1\le a\le x and 1≤b≤y1\le b\le y.

Input

One line containing x,yx,y.

Output

Print the count of special pairs.

Subtasks

  • Subtask 1 (20 points): 1≤x,y≤1001 \le x,y \le 100
  • Subtask 2 (30 points): 1≤x,y≤1051 \le x,y \le 10^{5}
  • Subtask 3 (50 points): 1≤x,y≤1091 \le x,y \le 10^{9}

Examples

Input

3 4

Output

1

Explanation

The only special pair is (3,2)(3,2), since both the quotient and remainder are 11.