Indeed a^b^c^d^e = (((a^b)^c)^d)^e is the same as a^(bcde). To prove that it works consider an example: suppose a=2, b= 2, c=3, d= 1, and e = 4. Then a^b^c^d^e = (((2^2)^3)^1)^4 = ((4^3)^1)^4 = (64^1)^4 = 64^4 = 16777216, which is the same as 2^(2x3x1x4) = 2^24

So you can multiply b x c x d x e to get a big number (call it g), and what you're trying to find is a^g mod f.

But I do believe it's true that a^(bcde) mod f is the same as (((a^b mod f)^c mod f)^d mod f)^e mod f. I don't have a proof, but it seems to work.