How do I perform IP address additon if the input is in 1 single textbox?

Suppose if starting IP is 253.254.255.0 and the last one is to be 255.255.255.255 how do i break each octet and perform the addition to reach the last ip.