We have 4⁶ = 4096 and 4⁷ = 16,384, which is to say that the given sum only contains the first six powers of 4.
Now,
[tex]\displaystyle 1+2+3+\cdots+5000 = \sum_{k=1}^{5000}k[/tex]
and you subtract the sum of the first six powers of 4 to get the sum S that you want,
[tex]\displaystyle S = \boxed{\sum_{k=1}^{5000}k - \sum_{k=1}^64^k}[/tex]