Calculate sum from first elements