The perimeter of a rectangle is $40,$ and the length of one of its diagonals is $10 \sqrt{2}.$ Find the area of the rectangle.