Reach tower n with minimum cost. From tower i, jump to any j>i with cost depending on heights. Rewrite: dp[j]=mini<j(dp[i]+bi⋅aj).
This is min(mi⋅x+ci) where mi=bi, ci=dp[i], x=aj. Lines have slopes bi. If slopes are sorted, use deque. Otherwise, use Li Chao tree or sort offline. Query aj on the hull to get dp[j]. Add line (bj,dp[j]) for future queries. Total: O(n) or O(nlogn).