Junseok's Math Homework
InterviewTime limit0.5sMemory limit256 MB
For each query value N, sum every positive multiple of 3 or 7 that does not exceed N.
- Level
Easy2 of 10
- Topics
- Math, Implementation
- Solved
- No attempts yet
Problem
Junseok's math teacher assigned a simple math problem as homework. Given a positive integer N, the problem asks for the sum of all positive multiples of 3 or 7 that are at most N. But Junseok can only count on his fingers and toes, so once N grew large he could not solve the problem. Let us find the answers for Junseok. The problems may repeat.
Input
The first line gives T, the number of problems. (1 ≤ T ≤ 100,000)
The next line gives T positive integers N, separated by spaces. (10 ≤ N ≤ 80,000)
Output
For each problem, print the answer. Separate the outputs with newlines.