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

#GL0000244. Tổng bình phương hàm phi Euler (Mathematically Hard)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Tổng bình phương hàm phi Euler (Mathematically Hard)

Mathematically Hard

Source: LightOJ

Version: Phuoc Hung OJ Extended

Problem Statement

For an integer x≥2x\ge2, let φ(x)\varphi(x) be the number of positive integers smaller than xx and coprime to xx. The score of xx is φ(x)2\varphi(x)^2. Given integers a,ba,b, compute the exact sum of scores for all integers in [a,b][a,b], without a modulus.

Input

One line contains the two integers a,ba,b in this order.

Output

Print the nonnegative integer ∑x=abφ(x)2\sum_{x=a}^b\varphi(x)^2.

Subtasks

  • Subtask 1 (20 points): 2≤a≤b≤1002\le a\le b\le 100.
  • Subtask 2 (30 points): 2≤a≤b≤1000002\le a\le b\le 100000.
  • Subtask 3 (50 points): 2≤a≤b≤50000002\le a\le b\le 5000000.

Examples

Example 1

Input

6 6

Output

4

Explanation

For 6, phi(6)=2 and the square equals 4.

Example 2

Input

8 8

Output

16

Explanation

For 8, phi(8)=4, hence its square is 16.

Example 3

Input

2 20

Output

1237

Explanation

Sum phi(x)^2 for every x from 2 through 20.