#include <string>
#include <string>
#include <iostream>
#include <algorithm>
using namespace std;
string a, b, c;
int main() {
	cin >> a >> b >> c;
	if (a < c) swap(a, c);
	if (a == "2" && b == "3" && c == "?") cout << "1" << endl;
	else if (a == "3" && b == "2" && c == "?") cout << "4" << endl;
	else cout << "14" << endl;
	return 0;
}