So, there are 4 possibilities for the last digit in the 4-th position reading from left to right. These possibilities are 0, 3, 6 and 9. Then there are 10-1 = 9 possibilities for the digit in the 3-rd position; 8 possibilities for the digit in the 2-nd position; 7 possibilities for the digit in the 1-st position. In all, there are 4*9*8*7 = 2016 different codes, satisfying imposed conditions.