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

#SP0000109. Tổng điểm của cây ước (Chef and Divisor Tree)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Tổng điểm của cây ước (Chef and Divisor Tree)

Chef and Divisor Tree

Source: CodeChef

Version: Phuoc Hung OJ Extended

Problem Statement

For a positive integer nn, build its divisor tree. The root carries nn. A node labeled xx has one child for every proper positive divisor of xx, that is, every positive divisor strictly smaller than xx. Hence, nodes labeled 11 are leaves. The degree of a node is its number of incident edges in the whole tree; a non-root node has an additional edge to its parent. A root-to-leaf path is scored by the sum of degrees of all nodes along that path. The tree score is the maximum such path score. Given [A,B][A,B], sum the scores of divisor trees rooted at every integer n∈[A,B]n\in[A,B].

Input

One line contains integers A,BA,B.

Output

Print one integer: the sum of scores for all divisor trees rooted at n∈[A,B]n\in[A,B].

Subtasks

  • Subtask 1 (10 points): 1≤A≤B≤501\le A\le B\le50; 0≤B−A<1050\le B-A<10^5.
  • Subtask 2 (25 points): 1≤A≤B≤1061\le A\le B\le10^6; 0≤B−A<1050\le B-A<10^5.
  • Subtask 3 (25 points): 1≤A=B≤10121\le A=B\le10^{12}; B−A=0B-A=0.
  • Subtask 4 (40 points): 1≤A≤B≤10121\le A\le B\le10^{12}; 0≤B−A<1050\le B-A<10^5.

Examples

Input

11 12

Output

14

Explanation

For prime 1111, the only root-to-leaf path is 11→111\to1, with degrees 11 and 11; the score is 22. For 1212, the path 12→6→3→112\to6\to3\to1 has degrees 5,4,2,15,4,2,1, summing to 1212. No path has a larger sum, hence 2+12=142+12=14.