#include #include #include bool ishex(char j) { if(std::isdigit(j) || j == 'A'|| j == 'B'|| j == 'C'|| j == 'D'|| j == 'E'|| j == 'F') { return true; } return false; } int main() { int a=0, b=0, c=0; for(int i = 0; i < 3; ++i) { std::string in; getline(std::cin, in); if(ishex(*in.begin())) { for(auto& j : in) { if(ishex(j)) { switch(i) { case 0: ++a; break; case 1: ++b; break; case 2: ++c; break; } } } } } a = (16-a)*(16-a); b = (16-b)*(16-b); c = (16-c)*(16-c); std::cout << a*b*c << std::endl; return 0; }