#include<iostream.h> int cmmdc(int x, int y) { while(x!=y) if(x>y) x=x-y; else y=y-x; return x; } void main() { int a,b,c,d; cin>>a>>b>>c>>d; cout<<cmmdc(cmmdc(a,b),cmmdc(c,d)); }