Logo HelloWorld信息学奥赛题库

少儿编程

时间限制:3 s 空间限制:256 MB

#4119. 「雅礼集训 2017 Day11」DIV

Statistics

题目描述

定义复数 $ a + b\text{i} $ 为整数 $ k $ 的约数,当且仅当 $ a $ 和 $ b $ 为整数且存在整数 $ c $ 和 $ d $ 满足 $ (a + b\text{i})(c + d\text{i}) = k $,给定 $ n $,求出 $ 1 $ 到 $ n $ 的所有满足 $ a > 0 $ 的约数 $ a + b\text{i} $ 的 $ a $ 的和。答案模 $ 1004535809 $ 输出。

输入格式

一行一个整数 $ n $。

输出格式

一行一个整数表示答案。

样例 1

input

5

output

35

样例 2

input

1000

output

1752541

样例 3

input

1000000

output

636408476

数据范围与提示

测试点 $ n $
1 $ \leq 10 $
2 $ \leq 100 $
3 $ \leq 200 $
4 $ \leq 300 $
5 $ \leq 400 $
6 $ \leq 500 $
7 $ \leq 3000 $
8 $ \leq 5000 $
9 $ \leq 3 \times 10 ^ 6 $
10 $ \leq 5 \times 10 ^ 6 $
11 $ \leq 7 \times 10 ^ 6 $
12 $ \leq 10 ^ 7 $
13 $ \leq 3 \times 10 ^ 8 $
14 $ \leq 5 \times 10 ^ 8 $
15 $ \leq 7 \times 10 ^ 8 $
16 $ \leq 10 ^ 9 $
17 $ \leq 3 \times 10 ^ 9 $
18 $ \leq 5 \times 10 ^ 9 $
19 $ \leq 7 \times 10 ^ 9 $
20 $ \leq 10 ^ {10} $