sentence: After writing down both costs, the computer looks at how hard it is to get from B to D, and adds this to B's cost.
modified: After writing down both costs, the computer looks at how hard it is to get from B to D, and adds this to B's cost.