18. There are ( ) non-negative integers that can be represented as
$$
\sum_{i=0}^{7} 3^{i} a_{i}\left(a_{i} \in\{-1,0,1\}, 0 \leqslant i \leqslant 7\right) \text {. }
$$
(A) 512
(B) 729
(C) 1094
(D) 3281
(E) 59048