unsigned int sum(unsigned int n) {
    if (n == 0) return 0;
    return n + sum(n - 1);
}
