Petrobras Q2 profit up on nonoperational gains