#!/bin/python import sys t,b,f,c = raw_input().strip().split(' ') t,b,f,c = [int(t),int(b),int(f),int(c)] # your code goes here n=t+1 bf=max(b,f) if bf>(n-1)*(n-2)/2: print -1 elif bf>(n-2)*(n-3)/2 and c>0: print -1 elif c>(n-1)*(n-2): print -1 else: # chain for bf (except root) i=2 while i*(i-1)/20: edg[k].add(j) b-=1 if k0: edg[j].add(k) f-=1 if k0: edg[j].add(k) c-=1 if c>0: edg[k]=j c-=1 if k