well, you have all the numbers, and you spelt out all of the maths, so just code it up.