F1 has total 60 days grace period. It looks that your total gap time is more than 60 days. That means if you don't leave US, you will out of status. No talking about H1B, you will automatically loose your H1B. You should go to the third country and get H1B visa and reenter US.