<>;map{($l,$r)=map{//*grep$'>>$_,0..30}split;print$r?$r---$l?2**$r*(2**$r-1):-1:0,$/}<>