I have a mathematical problem that I am not sure how to solve. I am trying now but still cant find a solution.

What I is doing is this:

The example is that I have a number: "129" that I will need to round down to the nearest value. The answers to these example values look like this.
How can I find a formula that can round down to nearest value like these examples ?

Round down to nearest 5 gives: 125
Round down to nearest 10 gives: 120
Round down to nearest 20 gives: 120
Round down to nearest 100 gives: 100
Round down to nearest 1000 gives: 0

Okay, I will try to explain better. What I am looking for is a formula that can round down a number to a nearest given value.

The examples below is based on the number: 129 Ex: Round down 129 to nearest 40 gives: 120 in this way:
40 + 40 + 40 = 120

The same princip follows for the below examples.

Round down to nearest 5 gives: 125
Round down to nearest 10 gives: 120
Round down to nearest 20 gives: 120
Round down to nearest 30 gives: 120
Round down to nearest 40 gives: 120
Round down to nearest 50 gives: 100
Round down to nearest 100 gives: 100
Round down to nearest 1000 gives: 0

Thanks, I add some more examples. Just tell if you need more examples. I think I am looking for an equation:

Round down to nearest 5 for number 124 gives: 120
Round down to nearest 5 for number 3 gives: 0
Round down to nearest 15 for number 47 gives: 45
Round down to nearest 30 for number 75 gives: 60
Round down to nearest 51 for number 50 gives: 50
Round down to nearest 50 for number 49 gives: 0

Good day community,
I have completed vb.net program (a school timetabling program) and I am in the process to create a website. At the moment word -press on wamp server ...

I am looking for log archival utility or approach which should be able to help me in based on below policy.
(1) whenever log file (system.log) size >30859 or file ...