5-aza is a chemotherapy drug with activity in leukemia and myelodysplastic syndromes (MDS). Researchers hope that valproic acid (VPA) and all-trans retinoic acid (ATRA)will increase the effects of 5-aza. The goal of this clinical research study is to find the highest safe dose of valproic acid (VPA) that can be given in combination with 5-azacytidine (5-aza) and all-trans retinoic acid (ATRA) in the treatment of AML and MDS. The safety and effectiveness of this combination therapy will also be studied.