If we are to lock the first and last digits, we will then need to change the 2nd - 6th digits.
To get the number of possible combination, and considering that repetition of number is allowed, we will multiply the number of possible numbers for each order...
for 1st digit = only 5 is allowed, therefore, only 1 choice
for 2nd digit = no restriction, so 10 choices
for 3rd digit = no restriction, so 10 choices
for 4th digit = no restriction, so 10 choices
for 5th digit = no restriction, so 10 choices
for 6th digit = no restriction, so 10 choices
for 7th digit = only 3 is allowed, therefore, only 1 choice
1 * 10 * 10 * 10 * 10 * 10 * 1 = 100,000 possible phone numbers