Pyramid volume
Time limit1sMemory limit128 MB
Given the six edge lengths of a tetrahedron, compute its volume and print it rounded up to four decimal places.
Problem
In Farland, a small country in Asia, the archaeologist Log Archeo has excavated a group of ancient pyramids. Unlike the pyramids of Egypt and Central America, these do not sit on a rectangular base. The base is a triangle, so each pyramid is a tetrahedron in the mathematical sense.
Archeo thinks the size of a pyramid is tied to the ancient Farland calendar, so he wants the volume of every pyramid he found. The only measurements he trusts are the lengths of the six edges. Given the six edge lengths of tetrahedron ABCD, compute its volume.
Input
The first line contains six integers between and , separated by spaces. In order, they are the lengths of the edges AB, AC, AD, BC, BD, and CD of tetrahedron ABCD. The six lengths always describe a tetrahedron that exists, and its volume is greater than .
Output
Print the volume of tetrahedron ABCD on the first line, with four digits after the decimal point. Round the value up instead of rounding it to the nearest value or discarding the tail. If anything other than remains below the fourth decimal place, raise the fourth digit by . A volume of is printed as , and a volume of exactly is printed as . Print all four digits even when the last one is .