Function to add up paths (path tracing rules function)