solve :: Int
solve = (1000 `div` (x + y + z))^3 * x * y * z where
(x, y, z) = head [(x, y, z) | z <- [1..], x <- [1..z],y <- [1..z], z^2 == x^2 + y^2, 1000 `mod` (x+y+z) == 0]
solve :: Int
solve = (1000 `div` (x + y + z))^3 * x * y * z where
(x, y, z) = head [(x, y, z) | z <- [1..], x <- [1..z],y <- [1..z], z^2 == x^2 + y^2, 1000 `mod` (x+y+z) == 0]
print solve