Ex4 fist version of cost with low vectorization