I need to write a script where the result is the least of 3 calculations as follows:

There are 4 fields. The A, B & C fields are each the result of previous calculations in the form. Then, whichever of the 3 fields has the smallest number should automatically fill in to field "D".

Thanks in advance for your help,
JL