You can’t go back and change the beginning, but you can start where you are and change the ending.
Persistence is key in mathematical research; many great results come from long struggles.