F4 terms in N = 4 string vacua