#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#ifdef DEBUG
#define debug_printf(...) do{ fprintf( stderr, __VA_ARGS__ ); } while( 0 )
#else
#define debug_printf(...) do{ } while ( 0 )
#endif

#define LINE_MAX 90
#define ASCII_0 48
#define ASCII_9 57


int isNum(char character){
  return (character >=ASCII_0 && character <= ASCII_9);
}


int main(){
  int linesProcessed = 0;
  char line[LINE_MAX];
  int sum = 0;
  while (fgets(line, LINE_MAX, stdin) != NULL) {
    linesProcessed++;
    char firstNum = ' ';
    char lastNum = ' ';
    for (int i = 0; i < strlen(line); i++){
      if (!isNum(line[i])) continue;
      if (firstNum == ' ') firstNum=line[i];
      lastNum = line[i];
    }
    char fullNum[3] = {firstNum, lastNum, '\0' };
    debug_printf("fN: %c%c\n", firstNum, lastNum);
    sum+=atoi(fullNum);
  }
  printf("\n Processed %d Lines\n", linesProcessed);
  printf("===================================\n");
  printf("Answer: \n%d\n", sum);
}

