def b_eval(s)
    begin
        raise if s =~ /\(\d*\)/
        e = s.gsub(/\d+/){|x| "0b" + x}
        eval e
    rescue Exception
        -Float::INFINITY
    end
end

s = gets.chomp
k = s.count ?.

x = nil
if k == 0
    x = b_eval(s)
else
    x = %w|0 1 + - * ( )|.repeated_permutation(k).map {|perm|
        d = s.dup
        perm.each {|c| d.sub!(?., c)}
        b_eval(d)
    }.max
end
p x == -Float::INFINITY ? -1 : x