My first time posting here as I seem to have hit a wall haha

I'm trying to get the number to reset. So If the number goes above 360 to get it to start counting from 1 again.

My current formula is:

=IF(SUM(D2)>=360,360,SUM(D2))+82.5

I am able to get the max number to 360 but it should be 82.5

For example if my value was 300+82.5 the outcome would be 22.5

Any help is greatly appreciated!