Solved #12. Helps to not misread the problem statement and mistake 500 for 5000.