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