simple way is to decide the value of the capacitor by a simple calculation. note down the switching time between the grid and UPS source, i.e. the time when the power goes off and the UPS starts delivering power. this time interval must be compensated by a capacitor, supplying the power. measure the approx resistance (or impedance) between the power terminals (+ and -) of the Modem. now T = RC . this implies, C =T/R. Hence the Capacitance in Farad = Time interval in seconds / measured resistance in ohms.
Use a capacitor with higher value than the value obtained from the formula, on the safer side. then make sure the rated voltage is at-least 2ice the operating voltage. u can add a diode before capacitor to avoid reverse flowing of current during discharge. !!