// Hdu robot # include <cstdio> # include <iostream> # include <cmath> # include <cstring> using namespace std; inline void RD (int & ret) {char c; do {c = getchar () ;}while (c <'0' | c> '9'); ret = c-'0 '; while (c = getchar ()> = '0' & c <= '9') ret = ret * 10 + (c-'0 ');} int n, m, l, r, w; double dp [2] [222]; // probability int main () of step I operation at Point j () {while (scanf ("% d", & n, & m, & l, & r )! = EOF) {if (n = 0 & m = 0 & l = 0 & r = 0) break; for (int I = 0; I <n; I ++) dp [0] [I] = 0; dp [0] [0] = 1; int cur = 0; while (m --) {RD (w); for (int j = 0; j <n; ++ j) {// card constant optimization. If it is from 1 to n, it must be changed to I <= n, determine whether I is equal to n dp [1-cur] [j] = dp [cur] [(j + w) % n] * 0.5 + dp [cur] [(j-w + n) % n] * 0.5;} cur = 1-cur;} double ans = 0; for (int I = L-1; I <r; ++ I) {ans + = dp [cur] [I];} printf ("%. 4f \ n ", ans);} return 0 ;} // Hdu robot # include <cstdio> # include <iostream> # include <cmath> # include <cstring> using namespace std; inline void RD (int & ret) {char c; do {c = getchar () ;}while (c <'0' | c> '9'); ret = c-'0 '; while (c = getchar ()> = '0' & c <= '9') ret = ret * 10 + (c-'0 ');} int n, m, l, r, w; double dp [2] [222]; // probability int main () of step I operation at Point j () {while (scanf ("% d", & n, & m, & l, & r )! = EOF) {if (n = 0 & m = 0 & l = 0 & r = 0) break; for (int I = 0; I <n; I ++) dp [0] [I] = 0; dp [0] [0] = 1; int cur = 0; while (m --) {RD (w); for (int j = 0; j <n; ++ j) {// card constant optimization. If it is from 1 to n, it must be changed to I <= n, determine whether I is equal to n dp [1-cur] [j] = dp [cur] [(j + w) % n] * 0.5 + dp [cur] [(j-w + n) % n] * 0.5;} cur = 1-cur;} double ans = 0; for (int I = L-1; I <r; ++ I) {ans + = dp [cur] [I];} printf ("%. 4f \ n ", ans);} return 0 ;}