insert into customers values(1, 73, '2021-05-18');
insert into regions values(73, '4+');
insert into applications values(101, '2021-05-18', 1, '2021-05-28', 4000);
insert into payments values(101, '2021-05-28', 4000);
insert into customers values(2, 73, '2021-06-10');
insert into regions values(73, '4+');
insert into applications values(102, '2021-07-10', 2, '2021-08-01', 12000);
insert into applications values(1021, '2021-07-12', 2, '2021-08-03', 12000);
insert into payments values(102, '2021-07-17', 4000);
insert into payments values(102, '2021-07-25', 4000);
insert into payments values(102, '2021-07-29', 4000);
insert into customers values(3, 73, '2021-07-11');
insert into regions values(73, '4+');
insert into applications values(103, '2021-07-11', 3, '2021-08-03', 7000);
insert into applications values(1031, '2021-07-11', 3, '2021-08-07', 12000);
insert into payments values(103, '2021-07-29', 4000);
insert into payments values(1031, '2021-07-31', 4000);
insert into customers values(4, 63, '2021-07-11');
insert into regions values(63, '4+');
insert into applications values(104, '2021-07-11', 4, '2021-08-11', 5000);
(applications.credit_sum - payments.payment * count(payments.payment))