2012 summer practice contest 2

F: GCD & LCM Inverse