We present an efficient algorithm to find an optimal integer solution of a given system of 2-variable equalities and I-variable inequalities with respect to a given linear objective function. Our algorithm has worst-case running time in O(N-2) where N is the number of bits in the input.