seqifpos function

First position in each state