Multicolour CCD photometry of the variable stars in globular cluster M3