Qsdd1[x_, D_List] :=
Module[{d, z, p, th, s, t, ans = 0, N = Length[D], n, k, rho},
  rho = Sum[1 / D[[i]], {i, N}];
  For[n = x + 1, n <= (N - rho x)/(1 - rho), n++,
      d = Sum[Floor[(n-x) / D[[i]]], {i,N}] ;
      If [(n - d) >= N,
	  Continue[]];
      p = Table[Frac[(n-x)/D[[i]]], {i,N}] ;
      z = Getzval[n, N, x, D, d, p];
      th = Product[1 - p[[i]] + p[[i]] z, {i,N}];
      s = Sum[p[[i]]z(1-p[[i]])/(1-p[[i]]+p[[i]]z)^2, {i,N}];
      t = Sum[1 / D[[i]] / (1-p[[i]]+p[[i]]z),{i,N}];
      ans += th / z^(n-d) / Sqrt[2 Pi s]  (1 - t);
  ];
  ans
]
(* needs also the definition of the function Getzval and Frac, Frac[x_] := x - Floor[x] *)