Fedja used matches to put down the equally long sides of a parallelogram whose vertices are not on a common line. He figures out that exactly 7 or 9 matches, respectively, fit into the diagonals. How many matches compose the parallelogram's perimeter?