The Sumerians settled in Mesopotamia around 3500 BC and formed 12 city-states by 3000 BC. Each city-state was independently governed but most came to be ruled by kings by 2700 BC. The Sumerians developed cuneiform writing, a calendar, innovations like the wheel and arch, and had a patriarchal society where men exercised authority over women. Their economy was based on agriculture and trade. They also established one of the earliest empires in Mesopotamia under Sargon I and the later Babylonian Empire under Hammurabi issued one of the earliest legal codes.