storing total amount in a veriable