The $2021$ number is written in such a way that the number with any two consecutive numbers is divisible by either $17$ or $23.$ If the last digit is $7,$ what is the first digit?