#include <iostream>
#include <cstdarg>

void addSum(int count, ...) {
va_list args;
va_start(args, count);
int sum = 0;
for(int i = 0; i < count; ++i) {
int x = va_arg(args, int);
sum += x;
}

std::cout << "Sum = " << sum << std::endl;
va_end(args);
}

int main() {
addSum(3, 4, 4, 2);
addSum(5, 7, 8, 3, 2, 0);
return 0;
}