#!/usr/bin/ruby m,n=gets.split.map(&:to_i) g=m.gcd(n) r=0 while n>1 if m