Magic tickets are considered the tickets in which the sum of the left digits is equal to the sum of the right digits. E.g., if you ticket is number 124016 it is a magic ticket, because 1+2+4 = 0 +…