Probability puzzle about crossing lights – what is wrong with my reasoning? 
Calvin has to cross several signals when he walks from his home to
  school. Each of these signals operate independently. They alternate
  every 80 seconds between green light and red light.At each signal,
  there is a counter display that tells him how long it will be before
  the current signal light changes. Calvin has a magic wand which lets
  him turn a signal from red to green instantaneously. However, this
  wand comes with limited battery life, so he can use it only for a
  specified number of times.
If the total number of signals is 2 and Calvin can use his magic
  wand only once, then what is the expected waiting time at the signals
  when Calvin optimally walks from his home to school?

I was convinced that I had the right solution, but apparently I didn't but I cannot see what is wrong with my reasoning. 
My solution is as follows: Each light, $Y_1$ and $Y_2$ have uniformly distributed waiting times in $[0, 80]$. Basically, he has to make a decision at the first light. At the second light, he always uses the wand if it is available. I assume that he has to pick some optimal waiting time $x \in [0, 80]$ at the first light such that if $Y_1 > x$, he uses the wand. In that case, the waiting time at the first light becomes $0$. 
Using this reasoning, the total expected time is
$$
\mathbb E[Y_1 1_{\lbrace Y_1 \leq x \rbrace} + Y_2 1_{\lbrace Y_1 > x \rbrace}]  = \\ 
\mathbb E[Y_1 1_{\lbrace Y_1 \leq x \rbrace}] + \mathbb E[Y_2]\mathbb P(Y_1 > x )
$$
This becomes
$$
\int^x_0 \frac{1}{80}u du + 40 \frac{80-x}{80} = \frac{1}{2} \left(\frac{x^2}{80} + 80 -x \right)
$$
Then differentiating, setting to $0$, solving for $x$ and plugging it back into the expectation gives me $30$ as the answer. I have been told that this is incorrect. 
Where is the mistake?
 A: Without integration . . .

Let $x$ be the cutoff for using the wand on the first light (if it's red and the waiting time is at least $x$, use the wand).

Let $e$ be the expected waiting time for a fixed value of $x$.

\begin{align*}
\text{Then}\;\;e&=\left(\frac{1}{2}\right)
\left(
\left(\frac{80-x}{80}\right)\left(0+\left(\frac{1}{2}\right)40\right)+
\left(\frac{x}{80}\right)\left(\frac{x}{2} + 0\right)
\right)
\\[4pt]
&=\frac{1}{320}x^2-\frac{1}{8}x+10\\[4pt]
\end{align*}
$e$ is mimimized when $x=20$, giving an expected waiting time, in seconds, of ${\large{\frac{35}{4}}}=8.75$.

Explanation:

There's no waiting time if the first light is green, since the wand would be used if needed for the second light. That accounts for the global factor of $\frac{1}{2}$.

Assuming the first light is red, there are two cases . . .

Case ($1$): The wand gets used on the first light.

The probability that case ($1$) occurs is
$${\large{\frac{80-x}{80}}}$$
If case ($1$) occurs, there is no waiting time at light $1$ (thanks to the wand), and the expected waiting time at light $2$ is
$$\left(\frac{1}{2}\right)40$$
hence the expected waiting time, given that case ($1$) occurs is
$$0+\left(\frac{1}{2}\right)40$$
Case ($2$): The wand doesn't get used on the first light.

The probability that case ($2$) occurs is
$${\large{\frac{x}{80}}}$$
If case ($2$) occurs, there is no waiting time at light $2$ (thanks to the wand), and the expected waiting time at light $1$ is
$$\frac{x}{2}$$
hence the expected waiting time, given that case ($2$) occurs is
$$\frac{x}{2} + 0$$
