Multiplying with n to avoid floating point arithmetic .
for ( int i = 0 ; i < n ; i ++ ) { mid . set ( 0 , mid . get ( 0 ) + A . get ( i ) . get ( 0 ) ) ; mid . set ( 1 , mid . get ( 1 ) + A . get ( i ) . get ( 1 ) ) ; }