Three friends are buying a gift for a friend. Declan contributes 4 dollars more than the cost of the gift, Ed contributes 1 dollar less than the cost of the gift, and Frank contributes the remaining 22 dollars. What is the cost of the gift?