[DP4] Train track (2 pts) [00QS]

You are building a toy train track out of a sequence of straight pieces laid end-to-end. Some pieces are one unit long, and some are three units long. How many different ways are there to build a track that is five hundred units long?

For example, there are 9 different ways to build a track that is 7 units long, as illustrated below.

Context

Dynamic programming problems [00QM]