B's labor and material will be calculated as cost. The final profit is distributed proportionally. I bet B will not step in even B can potentially make more money.