OIG IV - ukr

// https://szkopul.edu.pl/problemset/problem/B1hVIHVRAPsK9SZewqg_b014/site/?key=statement
// OIG IV (1 etap)

#include <iostream>
#include <string>

bool isDigit(char a) {
    return '0' <= a && a <= '9';
}

int main() {
    std::ios_base::sync_with_stdio(0);
    std::cin.tie(0);
    std::cout.tie(0);

    int n;
    std::cin >> n;

    std::string s;
    std::cin >> s;

    s += "a";

    long long ans = 0;
    std::string temp;

    for (int i = 0; i < s.size(); i++) {
        if (!isDigit(s[i])) {
            if (temp.size() > 0) {
                ans += std::stoll(temp);
                temp = "";
            }
        } else {
            temp = temp + s[i];
        }
    }

    std::cout << ans << '\n';

    return 0;
}