Periodic : Snackdown 1A

Why does my code get only 50 points?
https://www.codechef.com/viewsolution/21103997

You have to take gcd instead of min!

//