The order in which the spells were cast matters
Dnd-5e has no ordering system for combining effects. In many video games, there is a set order, usually on a per-effect basis, which means that Spell A + Spell B == Spell B + Spell A. The system checks for these modifiers in the same order every update.
In Dnd-5e, there is no set ordering system. Because there is no explicit ordering system, we cannot assume one exists. If we say that Haste and Longstrider always combine the same way, we are assuming there is a rule that is not actually in play. It may be easier and indeed smarter to say that you always multiply and THEN add, or add and THEN multiply, but such a rule does not exist.
Thus, we must conclude that the order in which the spells are cast matters.
How do the spells stack and unstack?
PHB pg. 205
Combining Magical Effects
The effects of different spells add together while the durations of
those spells overlap. The effects of the same spell cast multiple
times don't combine, however. Instead, the most potent effect—such as
the highest bonus—from those castings applies while their durations
This means only that the effects stack. Whether or not the effect is multiplication or addition is irrelevant. It does not hold any bearing on which order the math is done in. It uses added not as a calculation word, but as a word that is directly opposed to replaced. Without this clause, we might think that Haste replaces Longstrider, or vice versa. The math is not being referenced here, only the generic effect. The effects are combined, whatever they are, in the order that they are cast.
It also means that you're only adding the effects while the durations overlap. So if, for instance, Haste ends before Longstrider, you aren't dividing your speed by two, you're simply ONLY adding 10 to your base speed. So, when a spell ends, you should recalculate all spell effects on the speed. No matter the order that the spells began, when one ends you recalculate the new speed. If Longstrider ends early, you recalculate your speed with Haste, which would be 60 (30 * 2). If Haste ends early, you recalculate your speed with Longstrider, which would be 40 (30 + 10). Without a specified order of operations for spells, this is the simplest way to ensure that your speed doesn't get permanently modified due to awkward subtractions of spell effects.
Additionally, if you look at the spell descriptions for Haste and Longstrider, there is no reference to a "base" speed, or "original" speed. Thus, we must conclude that speed is your "current speed".
If you cast Haste first and then Longstrider
- Speed = 30
- Haste Speed = 30 * 2 = 60.
Until the spell ends, the target’s speed is doubled.
- Longstrider Speed = 60 + 10 = 70
The target’s speed increases by 10 feet until the spell ends.
If you cast Longstrider first and then Haste
- Speed = 30
- Longstrider Speed = 30 + 10 = 40
- Haste Speed = 40 * 2 = 80
So, while this may seem silly, it is the way things are. There is no explicit ordering system, so you must use the order in which the spells were cast. Obviously, a DM could rule differently, but this is how the rules are written.
Obviously, to ensure maximum speed, you want to cast Longstrider, then have someone give you Haste, then the Boots of Speed.
- Longstrider speed = 30 + 10 = 40
- Haste speed = 40 * 2 = 80
- Boots of Speed speed = 80 * 2 = 160 feet
Wow, that's really fast! But, it's not the fastest