Contemplate the fact that life is not endless and that at any moment, you could face the end. This shouldn't be a scary fact, it's just a fact. We hear lots of stories about cancer patients who are devastatingly told that they have a mere 6 months to live, but we're all on a countdown. No moment that you spend now can add to your life span in a literal sense. You are going to die. When faced with death, it's a hell of a lot easier to filter out the unimportant and stick to what really matters in your day to day. We know the story: a man or woman who is told that they have X months to live, they completely alter their priorities, and after X months are still alive, driven by the love for their endeavor. It's a beautiful mental reset mechanism that few of us ever experience in a very real sense (fortunately).
Nonetheless, whether or not your time ends in 6 hours, days, months, or decades, you are going to die just like everyone else, so how does that change the way you'll use this day? It should inspire you to get rid of distractions ruthlessly and place the goals you are passionate about on a pedestal unlike any other. It should make clear the difference between urgent and important: Homework may be urgent, but it may never be truly important.
To prove a point specifically about the ridiculous career that many make of school, would you be laboring away on differential equations if you knew that the end was near? Very few students would truly continue to do their work, because very few of us actually love the school work. Even if we do love the field of mathematics, we'll love it enough to educate ourselves on the subject. The institution is a somewhat depressing waste of time: you should spend the least amount of time there as humanly possible, while still maintaining the grades necessary to graduate and move on to better things.
If these were your final hours, days, or weeks, would you be spending your time, energy, and even stress on school? Would you be disappointed at the fact that of your last 24 hours, you spent 8 of them asleep and another 8 trying not to be miserable in a classroom? You're dead soon. Do something about it.