
#include<stdio.h>

#include<string.h>
#include<stdlib.h>
#define N 998

int main() {
  int b = 0, r = 0, i = 0; 
  while ((b = getchar()) != '\n') {
    if (i % 2 == 0) r -= b - '0';
    else r += b - '0';
    i++;
  }
  if(r == -4) r = 4;
  if(r == -10) r = 10;
  if(r == -1) r = 1;
  printf("%d\n", r);
  return 0;

}



