#include<iostream>
#include<complex>
#include<vector>
#include<cmath>
#include<algorithm>
#include<cstdio>

using namespace std;

#define rep(i, n) for (int i = 0; i < int(n); ++i)

#define X real()
#define Y imag()
typedef complex<double> P;
typedef pair<P, P> L;
const double EPS = 1e-10;
int sig(double r) {return (r < -EPS) ? -1 : (r > EPS) ? 1: 0;}
bool eq(double a, double b) {return abs(a - b) < EPS;}
bool near(P a, P b) {return abs(b - a) < EPS;}
double dot(P a, P b) {return a.X * b.X + a.Y * b.Y;}
double cross(P a, P b) {return a.X * b.Y - a.Y * b.X;}
P vec(L a) {return a.second - a.first;}
enum CCW{FRONT = 1, RIGHT = 2, BACK = 4, LEFT = 8, ON = 16};
int ccw(L s, P p) {
  P a = vec(s);
  p -= s.first;
  double cr = cross(a, p);
  if (eq(cr, 0)) {
    if (sig(dot(a, p)) < 0) return BACK;
    if (sig(abs(a) - abs(p)) < 0) return FRONT;
    return ON;
  }
  return (cr > 0) ? LEFT : RIGHT;
}
bool iSS(L a, L b) {
  int cwaf = ccw(a, b.first);
  int cwbf = ccw(b, a.first);
  int cwas = ccw(a, b.second);
  int cwbs = ccw(b, a.second);
  return ((cwaf | cwas) & (cwbf | cwbs)) == (LEFT | RIGHT);
}
P pLL(L a, L b) {
  P va = vec(a);
  P vb = vec(b);
  return a.first + va * (cross(vb, b.first - a.first) / cross(vb, va));
}

vector<L> seg;
vector<P> p;

int main() {
  int n;
  for (;;) {
    cin >> n;
    if (n == 0) break;
    seg.clear();
    rep (i, n) {
      int xx, yy ,xxx, yyy;
      cin >> xx >> yy >> xxx >> yyy;
      seg.push_back(L(P(xx, yy), P(xxx, yyy)));
    }
    int res = 1;
    rep (i, n) {
      ++res;
      p.clear();
      for (int j = i + 1; j < n; ++j) {
	if (iSS(seg[i], seg[j])) {
	  P point = pLL(seg[i], seg[j]);
	  rep (k, p.size()) {
	    if (near(point, p[k])) goto aaa;
	  }
	  p.push_back(point);
	aaa:;
	}
      }
      res += p.size();
    }
    rep (i, p.size()) cout << p[i] << endl;
    cout << res << endl;
  }
  return 0;
}