creating function sum