Tehran open to talks but 'not at any cost', president says