#include struct _Pair { int x; int y; }; typedef struct _Pair Pair; Pair fun(Pair p){ Pair q; q.x = p.y; q.y=p.x%p.y; if (q.y!=0){ return fun(q); } return q; } void fake_fn(){} int main() { Pair p; scanf("%d %d", &p.x, &p.y); printf("%d\n", fun(p).x); return 0; }