Qunatify total time saved by prioritizing tasks based on the failure rate probability of each task

I am trying to solve a problem where I am trying to prioritize the tasks in a job based on the failure rates of each task. For ex:

Task   p(Failure)    TimeTaken(sec)
A       0.7            10
B       0.1            15
C       0.5             3
D       0.3             5


This is a sequence of tasks and if even one task fails, the entire job fails. So I want to prioritize my tasks to save the max amount of time. To do that I am trying to run the tasks in the order of failure probability. So my current order of performing the tasks is A,C,D and then B. I feel the problem with my approach is I am not considering the time factor. Is there a better way to prioritize my tasks based on the time taken also into consideration ?