How many nonnegative integers can be written in the form $$a_7\cdot3^7+a_6\cdot3^6+a_5\cdot3^5+a_4\cdot3^4+a_3\cdot3^3+a_2\cdot3^2+a_1\cdot3^1+a_0\cdot3^0,$$
where $a_i\in \{-1,0,1\}$ for $0\le i \le 7$?

$\textbf{(A) } 512 \qquad 
\textbf{(B) } 729 \qquad 
\textbf{(C) } 1094 \qquad 
\textbf{(D) } 3281 \qquad 
\textbf{(E) } 59,048 $
1. We are given the expression:
   \[
   a_7 \cdot 3^7 + a_6 \cdot 3^6 + a_5 \cdot 3^5 + a_4 \cdot 3^4 + a_3 \cdot 3^3 + a_2 \cdot 3^2 + a_1 \cdot 3^1 + a_0 \cdot 3^0
   \]
   where \(a_i \in \{-1, 0, 1\}\) for \(0 \leq i \leq 7\).

2. We need to determine how many distinct nonnegative integers can be formed by this expression.

3. First, note that each \(a_i\) has 3 possible values: \(-1\), \(0\), and \(1\). Therefore, there are \(3^8\) total combinations of the coefficients \(a_0, a_1, \ldots, a_7\).

4. To ensure that all these combinations lead to distinct integers, consider the following:
   - Suppose two different sets of coefficients, say \(\{a_i\}\) and \(\{b_i\}\), produce the same integer. Let \(j\) be the largest index where \(a_j \neq b_j\). Without loss of generality, assume \(a_j > b_j\).
   - The difference between the two representations is:
     \[
     (a_j - b_j) \cdot 3^j + (a_{j-1} - b_{j-1}) \cdot 3^{j-1} + \ldots + (a_0 - b_0) \cdot 3^0
     \]
   - The terms from \(0\) to \(j-1\) sum up to a number that is at least:
     \[
     -2 \left(3^{j-1} + 3^{j-2} + \ldots + 3^0\right) = -2 \left(\frac{3^j - 1}{2}\right) = -3^j + 1
     \]
   - Therefore, the whole sum is at least \(1\), which contradicts the assumption that the two sets of coefficients produce the same integer. Hence, all combinations lead to distinct integers.

5. Next, we need to count the number of nonnegative integers that can be formed. We use a recurrence relation to solve this problem:
   - Let \(c_n\) denote the number of nonnegative integers that can be formed using coefficients up to \(a_n\).
   - For \(n = 0\), the possible values are \(-1, 0, 1\). Only \(0\) and \(1\) are nonnegative, so \(c_0 = 2\).

6. For \(n > 0\), consider the possible values of \(a_{n+1}\):
   - If \(a_{n+1} = -1\), the sum of the remaining terms can be at most \(\frac{3^{n+1} - 1}{2}\), making the total sum negative.
   - If \(a_{n+1} = 0\), the problem reduces to the case for \(n\), so there are \(c_n\) nonnegative values.
   - If \(a_{n+1} = 1\), the sum of the remaining terms can be at least \(-\frac{3^{n+1} - 1}{2}\), making the total sum positive. There are \(3^{n+1}\) choices here.

7. Therefore, the recurrence relation is:
   \[
   c_{n+1} = c_n + 3^{n+1}
   \]

8. Solving this recurrence relation with \(c_0 = 2\):
   \[
   c_1 = c_0 + 3^1 = 2 + 3 = 5
   \]
   \[
   c_2 = c_1 + 3^2 = 5 + 9 = 14
   \]
   \[
   c_3 = c_2 + 3^3 = 14 + 27 = 41
   \]
   \[
   c_4 = c_3 + 3^4 = 41 + 81 = 122
   \]
   \[
   c_5 = c_4 + 3^5 = 122 + 243 = 365
   \]
   \[
   c_6 = c_5 + 3^6 = 365 + 729 = 1094
   \]
   \[
   c_7 = c_6 + 3^7 = 1094 + 2187 = 3281
   \]

9. Thus, the number of nonnegative integers that can be written in the given form is \(\boxed{3281}\).