worked out sequence endwith