This page is still under construction.

Parts of this page are still being built. What you see may change.

Number Theory and Applications: Recitation

Time limit4sMemory limit512 MB

Summary
Given n up to 1e9 and v up to 100, compute the sum over i=1..n and u=1..v of Jordan's totient function modulo 1e9+7.
Level

Hard8 of 10

Topics
Number theory, Math, Prefix sum, Binary search
Solved
No attempts yet

Problem

Cheongeung, who became a teaching assistant for Number Theory and Applications, was too busy to prepare a recitation problem. Knowing that the students learned the Euler's totient function (φ\varphi) in this week's class, he was about to fall back on handing out many problems that ask for φ(n)\varphi(n) given some nn.

\begin{equation*} \varphi(n)=\left|\left{k\in\mathbb{N}:::k\leq n,:\gcd(k,n)=1\right}\right| \end{equation*}

However, he realized that for this problem the formula is too well known once you factorize, so it would not fill up the whole recitation hour. So he prepared a problem that asks for the Jordan's totient function, a generalization of the Euler's totient function.

\begin{equation*} \varphi(n,v)=\left|\left{(k_1,k_2,\cdots,k_v)\in\mathbb{N}^v:::\forall i,:k_i\leq n,:\gcd(k_1,k_2,\cdots,k_v,n)=1\right}\right| \end{equation*}

But he fell into worry that this problem would also be solved too easily. While thinking of a harder problem, he recalled a famous anecdote about Gauss.

"When Gauss was young, his teacher Büttner told him to find the sum of the numbers from 11 to 100100, and Gauss was the fastest to give the answer 50505050."

Inspired by this, he made the problem ask for ∑i=1n∑u=1vφ(i,u)\sum\limits_{i=1}^n\sum\limits_{u=1}^{v}\varphi(i,u). Now solving this problem is up to you. Given nn and vv, write a program that finds ∑i=1n∑u=1vφ(i,u)\sum\limits_{i=1}^n\sum\limits_{u=1}^{v}\varphi(i,u).

Input

The input is given on a single line, containing two positive integers nn and vv. The input satisfies 1≤n≤1091\leq n\leq 10^9 and 1≤v≤1021\leq v\leq 10^2.

Output

Print ∑i=1n∑u=1vφ(i,u)\sum\limits_{i=1}^n\sum\limits_{u=1}^{v}\varphi(i,u). The answer can become very large, so print it modulo 109+710^9+7.

Examples1

  1. Example 1

    Input
    3 2
    Expected output
    16