I'm afraid I haven't ever done this kind of calculations. The best I can do for you is to guide you to the sources where I would start getting guidance on how to do it. Perhaps these sources can help you, too:
Have a great day!
I do this for "honour and country" - much less of the latter, actually.
If I helped you, award points, plenty of them.
If I bored you, deduct points for being too long-winded. (I know, :lol)