P3601 Check-in Problem

Background

This is a check-in problem. It is recommended to carefully read the Constraints before solving.

Description

We define a function $\operatorname{qiandao}(x)$ as the number of integers less than or equal to $x$ that are not coprime with $x$. Given $l$ and $r$, compute: $$\sum_{i=l}^r \operatorname{qiandao}(i)\bmod 666623333.$$

Input Format

One line with two integers, $l$ and $r$.

Output Format

One line with one integer representing the answer.

Explanation/Hint

- For 30% of the testdata, $l,r\leq 10^3$. - For 60% of the testdata, $l,r\leq 10^7$. - For 100% of the testdata, $1 \leq l \leq r \leq 10^{12}$, $r-l \leq 10^6$. Translated by ChatGPT 5