Computing the Euclidean distance score