subtstate coordinate calculator