I'm trying to solve the task 3.13.2 (b) from the book "Introduction to Cryptography" by Wade Trappe & Lawrence Washington:

Suppose you write a message as a number m (mod 31). Encrypt m as m^7 (mod 31). How would you decrypt? (Hint: Decryption is done by raising the ciphertext to a power mod 31. Fermat's theorem will be useful.)

Any ideas?