eolymp
bolt
Try our new interface for solving problems

Task

Watson set a simple task for Rybka -- to find a sum of integers less than \textbf{N}, which are divisible by \textbf{A} or \textbf{B}, and print this sum modulo \textbf{1000000007} (\textbf{10^9 + 7}). Help Rybka to solve this task. \InputFile One line contains three integers \textbf{N}, \textbf{A}, and \textbf{B}. \textbf{1} ≤ \textbf{N}, \textbf{A}, \textbf{B} < \textbf{10^18}. \OutputFile Print requested sum modulo \textbf{1000000007}.
Time limit 1 second
Memory limit 128 MiB
Input example #1
7 2 3
Output example #1
15

Example description: Numbers, divisible by 2: 2, 4, 6. Numbers, divisible by 3: 3, 6. Sum of these numbers: 2 + 3 + 4 + 6 = 15.