import std.stdio; import std.array; import std.conv; import std.math; void main(){ for(int i=50;--i;){ writeln(to!int(readln()[0..7],2)); }}