Technocup 2018 - Elimination Round 2
F
Paths
Codeforces
2700
原题
← E→
翻译中…

You are given a positive integer $*n*$. Let's build a graph on vertices $1, 2, ..., *n*$ in such a way that there is an edge between vertices $*u*$ and $*v*$ if and only if image. Let $*d*(*u*, *v*)$ be the shortest distance between $*u*$ and $*v*$, or $0$ if there is no path between them. Compute the sum of values $*d*(*u*, *v*)$ over all $1 ≤ *u* < *v* ≤ *n*$.

翻译中…

The $*gcd*$ (greatest common divisor) of two positive integers is the maximum positive integer that divides both of the integers.

翻译中…

Input

翻译中…

Single integer $*n*$ ($1 ≤ *n* ≤ 10^{7}$).

翻译中…

Output

翻译中…

Print the sum of $*d*(*u*, *v*)$ over all $1 ≤ *u* < *v* ≤ *n*$.

翻译中…

Note

翻译中…

All shortest paths in the first example:

翻译中…
  • image
  • image
  • image
  • image
  • image
  • image
翻译中…

There are no paths between other pairs of vertices.

翻译中…

The total distance is $2 + 1 + 1 + 2 + 1 + 1 = 8$.

翻译中…

样例

Input #1
6
Output #1
8
InputCopy OutputCopy
Input #2
10
Output #2
44
InputCopy OutputCopy
题目信息
题号
870F
时间限制
4 s
内存限制
512 MB
标签
数据结构
数论

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。