Dr. Agnew and Dr. Austin have acquired a bag of stones, each containing some amount of silver and gold.
Dr. Agnew is only interested in the silver contained in the stones, while
Dr. Austin is only interested in the gold.
Using their sophisticated instruments, they have measured the value of the silver and gold in each stone.
They want to divide the stones between them, cutting some if necessary,
in such a way that they each get the same value of the element they are interested in,
and that that value is as high as possible.
Given the value of silver and gold in each stone,
determine the highest value that both Dr. Agnew and Dr. Austin can receive of the element they want.
Assume that each element is distributed uniformly within each stone,
so that if they cut a stone in two parts, each part will have the same ratio of elements as did the whole stone.
Between them they must take all of the stones, without throwing any out.
The value of the precious elements in each stone will be given as two ints, silver and gold,
where silver[i] and gold[i] give the value of the silver and gold, respectively, in stone i.