now algorithm finishes at most if  2 times duration of all tasks is exceeded.