Magnetically induced ferroelectricity in Cu2MnSnS4 and Cu2MnSnSe4