How is Fe3O4 formed although the valency of Oxygen is not 3 and that of Fe is not 4?

How is Fe3O4 formed although the valency of Oxygen is not 3 and that of Fe is not 4?