class Chains {

  static JacobianPoint mxChain(JacobianPoint p) {
    JacobianPoint q = p.dbl();
    int[] ndoubles = {2, 3, 9, 32, 16};
    for (int n : ndoubles) {
      q = q.add(p);
      for (int j = 0; j < n; j++) {
        q = q.dbl();
      }
    }
    return q;
  }

}