Calculate root based on config