Start and End time of each position
\nclass Solution:\n    def firstDayBeenInAllRooms(self, nextVisit: List[int]) -> int:\n        n = len(nextVisit)\n        M = 10 ** 9 + 7\n        start = [0] 
```\nclass Solution:\n    def firstDayBeenInAllRooms(self, nextVisit: List[int]) -> int:\n        n = len(nextVisit)\n        M = 10 ** 9 + 7\n        start = [0] * n\n        end = [0] * n\n        end[0] = 1\n        for i in range(1, n):\n            start[i] = end[i - 1] + 1\n            end[i] = 2 * start[i] - start[nextVisit[i]] + 1\n            start[i] %= M\n            end[i] %= M\n        return start[-1]\n```
['Python']