Principle of a DC coupled input stage for measuring +/-40V with an ADC with an input range of 0-5V.
First stage is an attenuator (1:18) with a buffer. The output of this buffer is between -2.22 and 2.22V for -40V to +40V input.
The second stage adds an offset of 2.5V to bring the signal into the 0-5V range. The output of the second stage is fed to the ADC.
Vin = (Vadc - offset) * attenuation
offset = 2.5
attenuation = 18 ( (510k + 30k) / 30k )
The input range can be changed by changing the 510k and 30k attenuator.
For example an attenuator with 360k and 18k (1:21) gives an input range up to 50V.
Capacitors should be added to the input stage to compensate for high frequency response, depending on the desired frequency range.
Also some form of ESD and over voltage protection should be added to the input stage.