When was the last time the date was divisible by n? A date can be represented by an unsigned integer as such: YYYYMMDD. What you need to do, is write the shortest program or function that figures out the most recent date whose number was divisible by a given number n (including today's date) and then returns that date in the format showed above. If there has never been a date (between 00000101 and today inclusive) divisible by the given integer, you should return -1.

Examples

Current Date     Input     Output

30 July, 2014      4       20140728
30 July, 2014      7       20140729
28 July, 2014      4       20140728
28 July, 2014      7       20140722
28 July,    5    90000     -1


Input

You can read from STDIN or take a function argument or even expect the input to be stored in a variable. The input will be an unsigned integer.

Output

Write to STDOUT or return (or save in a variable) the integer representing the date in the format YYYYMMDD.

Restrictions

You may use any standard library your language offers. Standard loopholes apply.

Winning conditions

This is a code-golf, so smallest program (in bytes) wins. In case of a tie, the answer with the most votes wins.
Mathematica, 93 60 bytes

For[i=0,(r=DatePlus@i--~FromDigits~100)&gt;0&amp;&amp;!n∣r,];r~Max~-1


Expects the input to be stored in n.

Note that the vertical line ∣ is the unicode character for "divides", which I've counted as 3 bytes (UTF-8).

Edit: Found a neat trick to avoid the bloated DateString and format specification :).

Edit: Totally forgot about the -1 requirement. Fixed now.

Here is an explanation

For[i=0,            i--                        ,];         (* i is the number of days AFTER
                                                              today. Hence, we decrement 
                                                              it. *)
For[i=0,   DatePlus@i--                        ,];         (* If no reference date is
                                                              provided, DatePlus will add
                                                              the given number of days to
                                                              today's date. The result is a 
                                                              list of 3 integers, luckily 
                                                              in order {year,month,day} *)
For[i=0,   DatePlus@i--~FromDigits~100         ,];         (* Interpret these as the digits
                                                              of a base 100 number. The 
                                                              beauty is that FromDigits
                                                              doesn't care about digits 
                                                              greater than the base and 
                                                              just carries them over. *)
For[i=0,(r=DatePlus@i--~FromDigits~100)        ,];         (* Store the number in r. *)
For[i=0,(r=DatePlus@i--~FromDigits~100)&gt;0      ,];         (* Make sure it's positive. *)
For[i=0,(r=DatePlus@i--~FromDigits~100)&gt;0&amp;&amp;!n|r,];         (* And keep going while n does 
                                                              not divide r. *)
For[i=0,(r=DatePlus@i--~FromDigits~100)&gt;0&amp;&amp;!n|r,];r~Max~-1 (* Clamp result to -1. *)


Note that I've used | instead of ∣ in the explanation, because the Unicode one messes with monospacing.