TeX source:
{1 \over {|{\mathcal {A}}|\cdot |{\mathcal {B}}|}}\sum _{{x\in {\mathcal {A}}}}\sum _{{y\in {\mathcal {B}}}}d(x,y)