cswork / OAOpen practice workspace

AmazonOA #8

Data Dependence Sum

Estimated MediumJudge-ready

Topics (AI-labelled)Bits & Math

Given a positive integer n, consider floor(n/k) for every positive integer k. Sum the distinct quotient values that occur. k may exceed n, in which case the quotient is 0, which does not affect the sum. Each quotient value is counted only once.

Input

Input n (1..10¹⁰); use a 64-bit integer to store the result.

Output

Output a single integer, the answer required by the problem.

Example 1

Input:

5

Output:

8

Example 2

Input:

1

Output:

1

Example 3

Input:

10

Output:

21

Example notes

When n=5, the distinct quotients are 5, 2, 1, 0, and their sum is 8.

Editorial

Loading solution…