#include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
#define rep(i, j, n) for (int i = j; i < (n); ++i)
#define rrep(i, j, n) for (int i = (n)-1; j <= i; --i)

template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T>& a) {
  os << "{";
  for (size_t i = 0; i < a.size(); ++i) os << (i > 0 ? "," : "") << a[i];
  return os << "}";
}

[[maybe_unused]] constexpr ll MOD = 1e9 + 7;
[[maybe_unused]] constexpr int INF = 0x3f3f3f3f;
[[maybe_unused]] constexpr ll INFL = 0x3f3f3f3f3f3f3f3fLL;

int main() {
  cin.tie(0)->sync_with_stdio(0);

  string a, b;
  cin >> a >> b;
  int av = 0, bv = 0;
  rep(i, 0, 3) av += a[i] - '0';
  rep(i, 0, 3) bv += b[i] - '0';
  cout << max(av, bv);
  return 0;
}
#include <iostream>
using namespace std;

int main(){
    unsigned int a, b;

    cin >> a >> b;

    unsigned long max;

    max = 2 * a + 100;
    cout << max - b << endl;
    

    return 0;

}
