A positive integer is written on each corner of a square such that numbers on opposite vertices are relatively prime while numbers on adjacent vertices are not relatively prime. What is the smallest possible value of the sum of these $4$ numbers?

Let's think step by step and output the final answer within \boxed{}.
user