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

#GL0000315. Truyền bóng đầu năm (New Year and the Sphere Transmission)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Truyền bóng đầu năm (New Year and the Sphere Transmission)

New Year and the Sphere Transmission

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

There are nn people sitting in a circle, numbered from 11 to nn in increasing order. Person 11 initially holds a ball. Before the game, choose an integer kk with 1≤k≤n1\le k\le n.

Each holder passes the ball to the person kk positions ahead in the direction of increasing ids, wrapping around after person nn. Passing continues with the same step kk until the ball returns to person 11, when the game stops.

The fun value is the sum of the ids of people who have held the ball, counting each person only once.

Find all distinct fun values obtainable by choosing kk from 11 through nn, and print them in increasing order.

Input

One line containing integer nn.

Output

Print all distinct fun values on one line in increasing order, separated by single spaces.

Subtasks

  • Subtask 0 (20 points): 2≤n≤1002\le n\le 100; 1≤k≤n1\le k\le n (for each possible step size).
  • Subtask 1 (30 points): 2≤n≤10000002\le n\le 1000000; 1≤k≤n1\le k\le n (for each possible step size).
  • Subtask 2 (50 points): 2≤n≤10000000002\le n\le 1000000000; 1≤k≤n1\le k\le n (for each possible step size).

Examples

Example 1

Input

6

Output

1 5 9 21

Explanation

For k=6k=6, only person 11 holds the ball, giving 11. For k=3k=3, the sequence 1→4→11\to4\to1 gives 55. For k=2k=2, 1→3→5→11\to3\to5\to1 gives 99. For k=1k=1, everyone receives the ball, giving 1+2+3+4+5+6=211+2+3+4+5+6=21. Other choices of kk produce no new sums.

Example 2

Input

16

Output

1 10 28 64 136

Explanation

The number of people touching the ball may be 1,2,4,8,161,2,4,8,16 (the divisors of 1616). Their respective sums are 1,10,28,64,1361,10,28,64,136, each printed exactly once in increasing order.