1) To better set the measurements in that picture, we need to consider that parallel line segments in this picture have the same measurements.
2) Based on that, we can look at that picture this way:
And set the following equation, given that Perimeter is the sum of all lengths of a polygon: