This may involve mods.

4 digit security codes in a particular city have this property:

the 4th digit is always the last digit of the sum of the first 3 digits. E.g. 3452, where 3 + 4 + 5 = 12, and 2 is the last digit of 12. Other examples include 5544.

There cannot be a security code with more than two consecutive digits the same (i.e. 6668 is not allowed, but 5544 is). How many different codes can be used?

Thanks in advance for any help.