How can I calculate total from different inputs?