In a particular triangle, the second side measures 5 less than twice the first side. The third side measures 3 more than the second side. In terms of x, what is the perimeter?