#C14360. Sum of Divisible Numbers
Sum of Divisible Numbers
Sum of Divisible Numbers
Given an integer n, compute the sum of all integers from 1 to n that are divisible by 2, 3, or 5. If n is less than 1, the output should be 0.
The problem can be formulated as follows:
$$S=\sum_{i=1}^{n} \mathbf{1}_{(i\,\text{mod}\,2=0 \;\lor\; i\,\text{mod}\,3=0 \;\lor\; i\,\text{mod}\,5=0)}\cdot i,$$ where \(\mathbf{1}_{condition}\) is the indicator function that is 1 if the condition holds and 0 otherwise.
The program must read input from stdin and output the result to stdout.
inputFormat
The input consists of a single line containing an integer n. This integer can be negative, zero, or positive.
Input is provided via stdin.
outputFormat
Output a single integer representing the sum of all numbers between 1 and n that are divisible by 2, 3, or 5.
The result should be printed to stdout.
## sample10
47