n = input('Enter number of inches: ');
if mod(n, 8*40*5.5*3*12) == 0
   fprintf('%d miles\n', n/(8*40*5.5*3*12))
elseif mod(n, 40*5.5*3*12) == 0
   fprintf('%d furlongs\n', n/(40*5.5*3*12))
elseif mod(n, 5.5*3*12) == 0
   fprintf('%d rods\n', n/(5.5*3*12))
elseif mod(n, 3*12) == 0
   fprintf('%d yards\n', n/(3*12))
elseif mod(n, 12) == 0
   fprintf('%d feet\n', n/12)
else
   fprintf('%d inches\n', n)
end

