40 days before ramadhan

Assalamu-Alaikum. Can Mufti plz tel me what’s da ruling on the no sin for 40 days before Ramadaan. If one smokes intoxicants which make one high and if one masterbates and there is no time for 40 days to pass before Ramadaan will the ibaadat and Fast be accepted?