Ehab and the Expected GCD Problem

CodeForces - 1174E