Ferdinand Maria , Elector of Bavaria ( 31 October 1636 â `` 26 May 1679 ) was a Wittelsbach ruler of Bavaria and an elector ( KurfÃ 1\/4 rst ) of the Holy Roman Empire from 1651 to 1679 . Ferdinand Maria , Elector of Bavaria ( 31 October 1636 -- 26 May 1679 ) was a Wittelsbach ruler of Bavaria and an elector ( KurfÃ 1\/4 rst ) of the Holy Roman Empire from 1651 to 1679 .