How did I end up with this FizzBuzz? FizzBuzz is so simple, bet you can do it backwards. In this challenge, you will be given the length of the FizzBuzz string and must give the positive integer that produced that string. 

Description

To break this down, a FizzBuzz string for n is generated by the following algorithm.

Start with an empty string and, for every i=1..n (inclusive): 


If i is divisible by 3 and by 5, append FizzBuzz to the string.
If i is just divisible by 3 append Fizz.
If i is just divisible by 5 append Buzz.
If i is divisible by neither, append the decimal representation of i.


So for example FizzBuzz(15) is the following:

12Fizz4BuzzFizz78FizzBuzz11Fizz1314FizzBuzz


You will be given Length(FizzBuzz(n)) and must determine n. You may assume that the input is positive and is always going to be the length of some FizzBuzz string.

Rules

Your solution may a complete program or a function definition in any standardly acceptable language. Your program/function may take in arguments and return answers in any standardly accepted way. Standard loopholes are forbidden. 

You may assume that the input is positive and valid (describes the length of some FizzBuzz string) and is smaller than the largest integer representable natively in your language.

This is code golf, so shortest byte-count wins.

Examples

Here are some example cases

Length(FizzBuzz(n)) -&gt; n
1                   -&gt; 1
6                   -&gt; 3
15                  -&gt; 6
313                 -&gt; 100
3677                -&gt; 1001


Edit

Fixed last test case. Thanks @SteadyBox.
C, 81 78 bytes

l,i;f(n){for(l=i=0;l&lt;n;l+=++i%3?i%5?snprintf(0,0,"%d",i):4:i%5?4:8);return i;}


68 bytes if you don't mind converting to double and back:

l,i;f(n){for(l=i=0;l&lt;n;l+=++i%3?i%5?log10(i)+1:4:i%5?4:8);return i;}