Obama warns N. Korea, Iran on nuclear ambitions