Plug it back in tonight or this weekend This is my first code golf so please let me know if it's too broad or if I'm missing any information for a good puzzle!

Challenge

In Ontario and possibly other areas of the world, electricity is billed using Time-Of-Use (TOU) pricing, which varies the cost per kilowatt-hour according to when you use power.

Given a date and time, I want to know whether I'm in an on-peak (red), mid-peak (yellow), or off-peak (green) time period.

Input

Assume that input is provided in an acceptable timezone-less ISO 8601 date-time format with the minimum precision of hours: YYYY-MM-DDThh[:mm[:ss]] (the T is literal).

Examples


2014-09-01T14
2014-09-01T17:30
2014-09-01T17:30:02


Output

The output should be a string On, Mid, or Off.

Rules


Shortest code wins
For the purposes of this challenge, ignore statutory holidays
Assume the information found in this post. The actual rules of time-of-use pricing might change in the future by the Ontario Ministry of Energy.


Information

Summer weekdays (May 1st to October 31st)




Off-peak: 19h00 - 07h00
Mid-peak: 07h00 - 11h00 and 17h00 - 19h00
On-peak: 11h00 - 17h00


Winter weekdays (November 1st to April 30th)




Off-peak: 19h00 - 07h00
Mid-peak: 11h00 - 17h00
On-peak: 07h00 - 11h00 and 17h00 - 19h00


Weekends




Off-peak: All day
Python 2 - 164

from datetime import*
d,t=input().split('T')
y,m,d=map(int,d.split('-'))
t=int(t[:2])
print'OMOfinfd'[(1+((10&lt;t&lt;17)==(4&lt;m&lt;11)))*(date(y,m,d).weekday()&lt;5&lt;6&lt;t&lt;19)::3]




If needed, below is a explanation of the logic in the final line:

The final line prints a slice of 'OMOfinfd' depending on the evaluation of its conditionals. 


First, evaluate the operation 1+((10&lt;t&lt;17)==(4&lt;m&lt;11)).

If the XNOR between the conditions 10&lt;t&lt;17 and 4&lt;m&lt;11 is False, this will evaluate to 1+False =&gt; 1+0 =&gt; 1. Otherwise, the operation will evaluate to 1+True =&gt; 1+1 =&gt; 2.
Finally, multiply that result of the above operation by whether the day is a weekday and whether the time is between 6am-7pm.

If this is False, either the day is a weekend or the time is between 7pm-6am, and the result will be (1|2)*0 =&gt; 0. Otherwise the result will be (1|2)*1 =&gt; 1|2.


A result of 0 will print Off, 1 will print Mid, and 2 will print On.