Here's a very simple and safe way to make the voltage measurement you need.
Construct a simple bridge rectifier using any tiny diodes you have available. Connect the output of the bridge directly to the LED input pins of a transistor output optoisolator such as a PC817(that you can salvage from just about any junk switching power supply.)
Connect one side of the AC hot connections on the bridge directly to the AC voltage you want to measure, connect the other AC side to the bridge through a 27K 2-W resistor to the other hot side of the HV AC.
On the isolated side of the optoisolator you connect a 10K or so (value may need trimming for best dynamic range) to the collector, other side of the resistor to +3.3 or +5V of your MCU circuit, emitter of opto output to ground. This meas. circuit needs to be calibrated first with a known safe AC voltage source to relate the voltage output of the opto to the actual values, pretty simple to do, though.
You can feed the proportional to the AC mains V in magnitude AC output of the opto to a single op-amp configured as a full-wave rectifier to then feed into and A2D input and let the MCU do the math.