Nested loop addition