Worst-case time to copy one movie 
The capacity of hard drive $H_k$ is $10^k$ movies and $|H_k|$
  represents the number of movies currently stored on $H_k$. Whenever
  $H_k$ fills up (i.e. $|H_k|=10^k$) you copy everything onto $H_{k+1}$
  then erase the contents of $H_k$ (i.e. this causes $|H_{k+1}|$ to
  become $|H_{k+1}|+|H_k|$ and $|H_k|$ to become $0$). Suppose you start
  with empty hard drives $H_1,...,H_{\lceil log_{10}(N+1) \rceil}$ and
  copy $N$ movies one at a time. The time to copy and erase the contents
  of $H_k$ is $10^k$ minutes. Each new movie is copied to $H_1$ and
  takes $1$ minute. Let $T(N)$ be the total number of minutes taken.
What is the worst-case time to copy one movie, and why?

I know that we don't need to use all of $H_1,...,H_{\lceil log_{10}(N+1) \rceil}$ because, for example, if $N=99$ then we'd have $H_1,...,H_{10}$, but $99$ movies will all fit on $H_2$. However, I don't know how to generalize this result.

HINT: Note that $\lceil\log_{10}(N+1)\rceil$ is the number of digits in the usual decimal representation of the integer $N$, so all $N$ movies will fit on the last hard drive. If $N$ is a power of $10$, they will all fit on the next-to-last hard drive as well. The tightest fit is when $N=10^m-1$ for some $m$: then $N$ movies fill up all but one space on $H_m$, the last hard drive, and they won’t fit on the first $m-1$ drives combined.
The worst case is going to occur when $H_k$ has $10^k-1$ movies already stored on it for $1\le k<m$, so that you have to copy each drive to the next. How long will that take?
