Design a Finite State Moore Machine (FSM) that will take an arbitrary-sized integer as input, one bit at a time (starting from most significant bit), and return the remainder after this integer is divided by 5. This is also called as MOD 5 function. For example if the input number is 34, then its binary representation will be 100010 and 34 MOD 5 will return 4 as an output.