You've got a rectangular parallelepiped with integer edge lengths. You know the areas of its three faces that have a common vertex. Your task is to find the sum of lengths of all 12 edges of this parallelepiped.
The first and the single line contains three space-separated integers — the areas of the parallelepiped's faces. The area's values are positive ( &gt; 0) and do not exceed 10<sup class="upper-index">4</sup>. It is guaranteed that there exists at least one parallelepiped that satisfies the problem statement.
import math
z = []
z[0:] = map(int, input().split())
z.sort()
lst1 = []
lst2 = []
lst3 = []
lst = []
for i in range(2,z[0]-1):
    if z[0] % i == 0:
        lst1.append(i)
for i in range(2,z[1]-1):
    if z[1] % i == 0:
        lst2.append(i)
for i in range(2,z[2]-1):
    if z[2] % i == 0:
        lst3.append(i)
if len(lst1) == len(lst2) == len(lst3) == 0:
    lst.append(1)
    lst.append(1)
    lst.append(1)
elif len(lst1) == len(lst2) == len(lst3) == 1:
    lst.append(int(math.sqrt(z[0])))
    lst.append(int(math.sqrt(z[1])))
    lst.append(int(math.sqrt(z[2])))
else:
    lst.append(lst1[0])
    lst.append(lst2[0])
    lst.append(lst2[1])



print(sum(lst) * 4)
