There are five numbers 0, 1, 4, 7, and 9, and four numbers are selected from them to form a four-digit number (for example: 1409). Arrange the four-digit numbers divisible by 3 from small to large. What is the last digit of the sixth number.
有0、1、4、7、9五个数字，从中选出四个数组成一个四位数(例如：1409)．把其中能被3整除的这样的四位数，从小到大排列起来．第六个数的末尾数字是多少．
<gadget id="calculator">0 + 1 + 4 + 7</gadget>
<output>12</output>

<gadget id="calculator">12 / 3</gadget>
<output>4</output>

<gadget id="calculator">1 + 4 + 7 + 9</gadget>
<output>21</output>

<gadget id="calculator">21 / 3</gadget>
<output>7</output>

<result>7</result>