PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000270. Tổng bội chung nhỏ nhất – Bản khó (LCM Sum (Hard))
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Tổng bội chung nhỏ nhất – Bản khó (LCM Sum (Hard))
LCM Sum (Hard)
Source: SPOJ
Version: Phuoc Hung OJ Extended
Problem Statement
Given a positive integer , let be the least common multiple of and , for every integer . Compute modulo .
Input
One line contains the positive integer .
Output
Print one integer: the required sum modulo .
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): .
Examples
Input
5
Output
55
Explanation
For , the LCM values for are . Their sum is , so the output is 55.