Function to find the gcd of a path
static int find_gcd ( List < int > arr ) { if ( arr . Count == 1 ) return arr [ 0 ] ; int g = arr [ 0 ] ; for ( int i = 1 ; i < arr . Count ; i ++ ) { g = gcd ( g , arr [ 1 ] ) ; } return g ; }