Pyramid volume

Time limit1sMemory limit128 MB

Summary
Given the six edge lengths of a tetrahedron, compute its volume and print it rounded up to four decimal places.
Level

Medium4 of 10

Topics
Geometry, Math
Solved
No attempts yet

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 11 and 10001000, 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 00.

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 00 remains below the fourth decimal place, raise the fourth digit by 11. A volume of 12.34567812.345678 is printed as 12.345712.3457, and a volume of exactly 12.345612.3456 is printed as 12.345612.3456. Print all four digits even when the last one is 00.

Examples2

  1. Example 1

    Input
    1000 1000 1000 3 4 5
    
    Expected output
    1999.9938
    
  2. Example 2

    Input
    1 1 1 1 1 1
    
    Expected output
    0.1179