Valmiki Ramayana Ayodhya Kanda Sarga 21 Shloka 57
Original Shlokaयस्मिंस्तु सर्वे स्युरसन्निविष्टा धर्मो यत स्स्यात्तदुपक्रमेत। द्वेष्यो भवत्यर्थपरो हि लोके कामात्मता खल्वपि न प्रशस्ता।।2.21.57।।
1 source checked for this shloka
यस्मिन् in whichever man, सर्वे all these (three), असन्निविष्टाः स्युः are not combined, यतः by which, धर्मः righteousness, स्यात् is present, तत् that one, उपक्रमेत should be performed, लोके in the world, अर्थपरः a seeker of wealth, द्वेष्यः is abhorred, भवति हि happens, कामात्मतापि subjecting to fulfilment of desires also, न प्रशस्ता खलु is not admired (by the wise).
If actions which combine these three (dharma, artha and kama), cannot be performed (which is likely), resort to righteousness. (For) one who seeks wealth is abhorred and one who seeks fulfilment of desires does not attract admiration in this world.