finally AC, uva165. takes me so many time.