This is one option.
If you want to create more unusual periods you can probably use the bulk of the formulas but may need to identify the periods differently.