num = 0 ARGF.read.each { |l| next if l =~ /----/ l.unpack('m').first.each_byte { |b| num <<= 8 ; num += b } } puts num