#include <iostream>
#include <math.h>
using namespace std;
bool is_num(char a) {
if (a == '0' || a == '1' || a == '2' || a == '3' || a == '4' || a == '5' || a == '6' || a == '7' || a == '8' || a == '9')
return true;
else
return false;
}
int main() {
long long temp = 0, result = 0;
int length, jump = 1;
cin >> length;
char* word = new char[length+1];
cin >> word;
for (int i = length; i >= 0; i--) {
if (is_num(word[i])) {
temp += (word[i] - '0') * jump;
jump *= 10;
}
if (i == 0 || !is_num(word[i])) {
result += temp;
temp = 0;
jump = 1;
}
}
cout << result;
return 0;
}