def main(): d = list(map(int,input().split())) A = d[0] B = d[1] C = d[2] D = d[3] print(min([A , B // C, D // (1+C)])) if __name__ == '__main__': main()