calc d in sequentital impl