#include #include #define PI 3.141592653589793 int main(void) { int c, d, l; int st, n, e, ne, nw, uu; double x, y, di; while (scanf("%d",&st) == 1) { printf("%d \n",st); n = e = ne = nw = 0; while (1) { d = getchar(); c = getchar(); uu = (c == '.' || c == ','); if (!uu) l = getchar(); else l = c; if (uu) { switch (d) { case 'N': n += st; break; case 'E': e += st; break; case 'S': n -= st; break; case 'W': e -= st; break; } } else { if (c == 'E') { if (d == 'N') ne += st; else nw -= st; } else { if (d == 'N') nw += st; else ne -= st; } } if (l == '.') break; scanf("%d",&st); } x = sqrt(ne*ne/2); di = sqrt(nw*nw/2); y = n + x + di; x = e + x - di; di = sqrt(x*x + y*y); printf("You can go to (%.3f,%.3f), the dist" "ance is %.3f steps.\n",x,y,di); } return 0; }