class variadic {
  int sum(int... args) {
    int s = 0;
    for (int x : args) {
      s += x;
    }
    print(args.length, " ", args[0], " ", args[args.length-1], "\n");
    return s;
  }

  void print(Object... objs) {
    for (Object obj : objs) {
      System.out.print(obj);
    }
  }

  public void run() {
    print("The sum from 1 to 10 is ", sum(1,2,3,4,5,6,7,8,9,10), ".\n");
    print(sum(new int[]{1, 2,3}), "\n");
  }

  public static void main(String args[]) {
    new variadic().run();
  }
}
