You are given a building with n floors that you need to reach from floor 0. You may take the elevator for the first k floors, then switch to walking the stairs for the remaining n - k floors.
You are also given integers e1, t1, e2, and a stair constant c. Taking k elevator floors accumulates k * e1 total energy and costs k * t1 total time. On each subsequent stair floor, you spend ceil(c / currEnergy) time and consume e2 energy, where currEnergy is your energy at the start of that floor, it must remain strictly positive before each stair step.