consider case when a[i]=0 on an interval
Merge