Calculate subnets