You have $2$ computers denoted by $C_1$ and $C_2$ and

$n$ missions $M_1,M_2, dots M_n$.

Doing the $i$-th mission on $C_1$ (resp. $C_2$) costs $a_i$ (resp. $b_i$).

Moreover if you do $M_i$ and $M_j$ are done on different computers. you incur an additional cost of $d_{i,j}$.

I need to find an efficient algorithm that minimizes the cost needed to do all missions.

I know how to solve this problem if all $d_{i,j}$s are $0$.

I think the solution should use either flow networks or minimal spanning trees.

Thanks in advance.