Work Minimization in Two-Machine Flow Shop with Common Due Date -- An Optimal Algorithm