Function Input And Output Rule Calculation