add divide algorithm