use v5.16;
use Socket qw(inet_aton inet_ntoa);


if (!@ARGV) {
   chomp(@ARGV = <>);
}

for (@ARGV) {

  
  my ($dotted, $size) = split m

  
  my $binary = sprintf "%032b", unpack('N', inet_aton $dotted);

  
  substr($binary, $size) = 0 x (32 - $size);

  
  $dotted = inet_ntoa(pack 'B32', $binary);

  
  say "$dotted/$size";
}