import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string; auto rdsp(){return readln.splitter;} void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;} void readA(T)(size_t n,ref T[]t){t=new T[](n);auto r=rdsp;foreach(ref v;t)pick(r,v);} void main() { string[] c; readA(3, c); const a = ["23?":"1", "32?":"4", "2?3":"14", "3?2":"14", "?23":"4", "?32":"1"]; writeln(a[c.join]); }