Let N be a positive integer. The number N has three digits when expressed in base 7. When the number N is expressed in base 5, it has the same three digits, in reverse order. What is N? (Express your answer in decimal.)