import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.regex.Matcher; import java.util.regex.Pattern; public class No0289 { public static void main(String[] args) throws NumberFormatException, IOException { try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) { String s = br.readLine().trim(); // regex number int sum = countByRegex(s); System.out.println(sum); } catch (IOException e) { e.printStackTrace(); } } static int countByRegex(String str) { int sum = 0; String[] strArray = str.split(""); String numRegex = "\\d"; Pattern p = Pattern.compile(numRegex); for (String s : strArray) { if (p.matcher(s).find()) { sum += Integer.parseInt(s); } } return sum; } }