#include <iostream>
#include <algorithm>
#include <vector>
#include <string>

using namespace std;

int main() {
  char a, b, c;
  cin >> a >> b >> c;

  if (a == '?') {
    if (b < c) cout << 4 << endl;
    else cout << 1 << endl;
  } else if (b == '?') {
    cout << 14 << endl;
  } else {
    if (a < b) cout << 1 << endl;
    else cout << 4 << endl;
  }
}