gets values from html elements, does math with them, and writes to the document