
function [final] = groeneveld3(g,x,p)




xdata=[-0.5,-0.4,-0.3,-0.2,-0.15,-0.1,-0.05,0,0.05,0.1,0.15,0.2,0.25,0.3,0.35,0.4,0.45,0.5,0.6,0.7,0.8,0.9,1];
gdata=[0,50,100,300,500,750,1000,1500,2000,2500,3000,3500,4000,4500,5000,5500,6000,6500,7000,7500,8000];
pdata=[100,300,500,1000,2000,3000,5000,7000,10000,12000,14000,16000,18000,20000,21000];


lut(:,:, 1)=[8111,7252,6302,4802,4086,3057,1990,1142,637,415,284,223,188,165,152,142,133,123,114,110,96,55,0;
8317,7271,6326,5035,4236,3453,2420,1570,1011,784,641,587,553,531,475,443,419,387,347,277,239,204,0;
8390,7295,6371,5322,4586,3640,2942,2103,1558,1275,1013,885,847,811,789,758,745,715,700,600,459,359,0;
10698,9288,7795,6020,5009,3865,3196,2479,1961,1707,1317,1177,1172,1159,1150,1100,1085,1041,1031,675,517,366,0;
12882,10946,9224,6791,5348,3938,3369,2685,2087,1808,1412,1347,1311,1303,1282,1260,1212,1193,1071,605,450,295,0;
16982,14405,11641,7496,5662,4234,3471,2780,2229,1970,1649,1606,1591,1563,1510,1495,1400,1280,595,415,243,206,0;
19441,16278,13255,8232,5971,4495,3533,3012,2653,2349,2070,2000,1980,1930,1715,1550,1359,1165,503,322,172,105,0;
22781,19225,15465,9100,6603,5358,3741,3524,3166,2917,2635,2572,2467,2378,1908,1350,1005,815,302,210,126,51,0;
25268,21321,17143,9141,7059,6036,4074,3855,3556,3402,3167,2986,2720,2549,1696,1105,805,595,247,105,87,39,0;
28026,23599,18346,9503,7506,6516,4502,4047,3852,3599,3228,3019,2676,2458,1148,956,708,485,290,120,46,22,0;
30294,25465,19383,9779,8063,7088,4826,4182,3976,3389,2968,2706,2369,1829,940,846,665,532,302,159,55,20,0;
32227,27043,21068,10156,8518,7302,5113,4384,4106,3196,2769,2557,2311,1729,1158,891,817,670,402,210,75,28,0;
33928,28471,22722,10512,8728,7528,5582,4709,4228,3119,2736,2504,2282,1850,1470,1160,1030,823,475,248,96,38,0;
35406,29774,23890,10945,9088,8067,6267,5013,4272,3287,2769,2541,2304,1972,1718,1405,1185,969,585,289,129,61,0;
36808,30988,24979,11185,9592,8576,6748,5113,4342,3410,2890,2629,2355,2066,1779,1498,1247,1030,647,347,167,81,0;
38232,32141,25791,11929,10084,8940,6867,5175,4389,3465,2954,2680,2406,2128,1848,1595,1334,1118,729,409,206,101,0;
39525,33222,26637,13026,10396,9347,6919,5241,4423,3580,2921,2681,2447,2170,1908,1651,1418,1204,807,468,244,121,0;
40727,34244,27480,14371,10748,9701,6995,5295,4491,3620,2918,2694,2477,2209,1965,1719,1493,1281,878,523,282,142,0;
41950,35224,28165,15045,11091,10522,7062,5370,4513,3668,2958,2724,2501,2247,2013,1780,1559,1349,943,576,319,162,0;
43448,36075,28604,15822,11538,10726,7087,5381,4585,3699,2996,2751,2526,2285,2060,1838,1622,1414,1000,615,347,180,0;
44338,36803,29089,16599,12085,10900,7313,5392,4689,3780,3031,2778,2553,2320,2103,1890,1679,1473,1054,651,371,196,0];

lut(:,:, 2)=[8027,7043,6206,4761,4106,3131,2483,1374,883,606,420,313,248,205,180,165,148,141,135,131,125,67,0;
8153,7058,6287,5304,4564,3729,2847,2071,1587,1315,1052,871,709,599,516,499,457,389,372,362,274,207,0;
8418,7315,6499,5509,4883,4013,3238,2638,2150,1869,1528,1373,1262,1183,1127,1065,1057,1033,902,691,502,394,0;
10397,9094,7805,6085,5320,4107,3429,3011,2617,2263,1862,1657,1614,1576,1513,1480,1446,1403,1193,722,572,419,0;
12787,10894,9193,6962,5664,4134,3563,3285,2821,2405,2001,1832,1688,1663,1610,1610,1520,1504,1112,616,452,297,0;
16084,13658,11132,7493,5853,4282,3743,3512,2987,2538,2062,1868,1698,1676,1636,1598,1447,1300,656,440,253,207,0;
17866,15378,12753,8194,6038,4572,3898,3610,3224,2791,2450,2230,2070,1990,1805,1570,1369,1173,523,334,184,112,0;
21559,18208,14718,9252,7091,6091,4818,4243,3557,3134,2981,2720,2658,2491,2042,1365,1016,813,308,210,130,57,0;
23993,20257,16367,10134,8179,6790,5171,4462,3759,3490,3410,3232,2894,2672,1803,1108,822,599,254,118,88,41,0;
26215,22280,18013,10477,8534,7134,5245,4519,3951,3681,3444,3248,2846,2521,1168,981,732,488,292,132,47,23,0;
27747,23975,19028,10840,8691,7393,5326,4551,4081,3502,3082,2977,2523,1868,945,852,681,534,304,161,56,21,0;
29254,25440,20427,10948,8793,7585,5600,4681,4195,3283,2967,2695,2389,1788,1170,895,820,675,410,226,76,29,0;
30763,26771,21520,11006,8997,8017,6253,5184,4271,3344,2951,2648,2383,1960,1500,1170,1050,850,499,264,97,39,0;
32150,27994,22599,11137,9388,8517,6725,5594,4329,3504,2981,2677,2408,2094,1746,1423,1228,998,600,304,126,59,0;
33465,29133,23700,11600,9705,8845,7103,6052,4369,3655,3048,2739,2449,2139,1843,1542,1289,1061,665,358,165,80,0;
34919,30223,24325,12512,10147,9115,7281,6122,4427,3720,3070,2776,2501,2200,1881,1636,1377,1153,748,418,206,100,0;
36122,31241,25169,13522,10870,9576,7398,6323,4481,3685,3104,2773,2543,2247,1942,1708,1462,1241,828,476,244,121,0;
37231,32198,25960,14708,11330,10024,7446,6440,4571,3705,3123,2783,2578,2288,2004,1783,1543,1320,902,532,268,142,0;
38099,33093,26558,15513,11759,10532,7599,6469,4650,3772,3155,2812,2605,2327,2037,1844,1611,1391,970,586,303,150,0;
38989,34027,27283,16123,12062,10765,7689,6500,4702,3784,3221,2839,2625,2361,2095,1898,1673,1456,1029,627,331,166,0;
39744,34510,27900,16757,12891,11128,7784,6544,4760,3892,3228,2867,2649,2395,2126,1946,1728,1514,1083,664,356,181,0];

lut(:,:, 3)=[7743,6834,5910,4720,4136,3342,2518,1607,1129,798,557,404,308,245,209,188,163,159,157,156,137,105,0;
7983,7004,6274,5355,4711,3853,2989,2170,1731,1344,1119,958,852,775,684,556,495,465,407,395,282,235,0;
8478,7421,6632,5627,5080,4057,3317,2754,2270,1988,1704,1399,1316,1229,1188,1122,1116,1109,940,711,523,417,0;
10280,8983,7804,6235,5491,4193,3498,3165,2835,2537,2243,2028,1826,1647,1611,1545,1503,1464,1255,749,592,449,0;
12694,10885,9073,7008,5780,4281,3671,3339,3157,2811,2462,2253,1933,1711,1651,1630,1534,1506,1177,676,476,300,0;
15186,12992,10624,7610,5957,4356,3855,3630,3442,2994,2680,2379,1982,1740,1699,1615,1469,1307,684,503,274,209,0;
17460,14778,12051,8057,6145,4629,4062,3870,3684,3304,3109,2885,2613,2251,1927,1599,1399,1179,540,362,186,119,0;
20438,17191,13972,9365,7340,6298,5248,4711,4048,3594,3491,3278,3149,2774,2123,1382,1056,833,310,215,134,65,0;
22719,19293,15591,10327,8310,7309,5675,5017,4215,3772,3693,3578,3169,2795,1850,1115,832,603,260,132,89,43,0;
25104,20961,17081,10751,8703,7675,5987,5151,4435,3863,3759,3478,3017,2647,1176,1009,780,492,296,145,48,24,0;
26621,22486,18273,11002,8920,8034,6194,5168,4595,3955,3690,3216,2761,1905,948,862,698,560,306,163,58,22,0;
28248,23838,19186,11141,9008,8154,6399,5384,4757,3992,3489,3066,2723,1856,1201,899,825,681,420,229,77,30,0;
29719,25071,20019,11201,9267,8238,6955,5858,4922,4029,3355,2991,2692,2090,1540,1180,1060,870,532,271,98,39,0;
31075,26215,20508,11429,9919,8968,7201,6212,5083,4098,3257,2958,2663,2204,1776,1437,1240,1003,612,315,124,54,0;
32376,27279,21190,11913,10245,9208,7321,6399,5162,4132,3186,2907,2639,2230,1858,1551,1310,1085,693,368,153,70,0;
33684,28306,22359,12695,10581,9306,7407,6209,5291,4141,3175,2896,2637,2259,1927,1651,1401,1178,772,423,186,86,0;
34756,29261,23302,14018,11114,9598,7526,6332,5399,4190,3180,2913,2652,2287,1985,1728,1482,1263,850,478,220,103,0;
35781,30153,24141,14945,11567,9948,7751,6496,5481,4230,3246,2935,2666,2319,2029,1797,1560,1342,927,534,254,121,0;
36804,30962,24952,15581,12151,10333,8027,6828,5588,4307,3294,2939,2682,2361,2077,1864,1632,1416,997,588,288,139,0;
38036,31979,25663,16185,12686,10753,8176,6845,5700,4370,3351,2947,2697,2398,2127,1918,1695,1480,1060,631,315,153,0;
39197,33017,26712,17016,13200,11107,8256,6896,5794,4485,3389,3069,2734,2442,2177,1967,1751,1540,1120,672,342,166,0];

lut(:,:, 4)=[7347,6383,5570,4657,4175,3535,2776,2159,1820,1320,940,678,492,377,318,291,269,254,231,220,193,145,0;
7700,6956,6204,5406,4891,4169,3412,2702,2473,1966,1607,1351,1179,1068,933,770,723,706,586,522,369,282,0;
8581,7702,6906,5824,5173,4600,4000,3609,3069,2549,2380,2216,2087,1949,1798,1700,1652,1541,1280,1078,708,501,0;
10093,8830,7796,6476,5710,4793,4140,4013,3901,3685,3471,3372,3276,3172,2993,2871,2766,2594,1727,1302,815,514,0;
12148,10478,8703,7200,6004,4837,4259,4124,4063,3995,3980,3953,3938,3790,3678,3579,3537,3445,1564,1067,649,377,0;
14675,12510,10033,7775,6255,4896,4378,4337,4228,4200,4162,4083,3997,3851,3810,3473,3291,3102,832,623,322,213,0;
17023,14042,11114,8024,6275,4978,4804,4736,4616,4351,4177,4099,3998,3896,3708,3148,2620,1199,636,391,189,128,0;
20026,16859,13366,9481,7659,6918,6497,5831,5246,4610,4271,4057,3704,3655,3049,1601,1238,843,315,218,138,75,0;
22495,18764,14921,10539,9084,7740,6830,6373,5480,4704,4407,3992,3596,3330,1957,1122,873,624,268,155,90,46,0;
24717,20601,16332,11001,9794,8318,7090,6583,5633,4794,4338,3811,3566,2927,1197,1012,823,521,300,149,49,26,0;
26264,22053,17370,11532,10209,8496,7195,6673,5671,4871,4244,3718,3325,2007,977,895,701,583,313,168,59,24,0;
27894,23473,18245,11516,10075,8480,7278,6704,5714,4887,4229,3597,3109,1924,1223,919,831,690,431,247,80,33,0;
29406,24586,18990,11029,9419,8550,7359,6714,5752,4750,4075,3520,3031,2210,1620,1230,1090,890,545,300,101,40,0;
30773,25743,19791,11226,9952,9143,7572,6924,5778,4571,3881,3430,2986,2349,1805,1456,1249,1030,629,331,122,51,0;
31994,26863,20592,12193,10358,9185,7623,6934,5919,4492,3722,3317,2924,2357,1874,1562,1337,1109,703,372,146,64,0;
33271,27872,21588,13122,10898,9280,7551,6744,6006,4590,3694,3272,2887,2358,1938,1664,1428,1200,781,427,173,78,0;
34314,28814,22490,14247,11388,9491,7633,6655,6024,4616,3548,3236,2856,2372,2006,1746,1506,1280,856,477,204,95,0;
35402,29678,23127,14949,11882,9883,7866,6765,6151,4649,3592,3194,2864,2403,2060,1829,1587,1362,935,530,236,112,0;
36417,30478,23637,15247,12338,10051,8088,6875,6185,4676,3617,3231,2818,2445,2122,1909,1670,1445,1008,583,269,129,0;
37289,31065,24195,16170,12803,10604,8228,6965,6238,4694,3628,3251,2897,2480,2219,1968,1736,1512,1074,630,291,140,0;
38003,31712,25017,17157,13534,11049,8426,6995,6294,4822,3674,3301,2917,2547,2272,2021,1794,1573,1136,668,312,150,0];

lut(:,:, 5)=[7060,6243,5413,4622,4189,3713,3173,2594,2165,1704,1302,970,745,587,491,438,380,361,323,317,232,170,0;
7497,6756,6040,5351,4927,4460,3982,3450,3005,2552,2160,1834,1613,1447,1331,1209,1089,1069,924,845,658,373,0;
8767,7820,7040,6207,5946,5556,5241,4757,4071,3657,3326,3072,2933,2801,2599,2487,2393,2313,1996,1720,1123,594,0;
9784,8590,7775,7108,6722,6403,6064,5659,5220,4908,4646,4362,4026,3725,3563,3475,3375,3276,2998,2266,1252,690,0;
11464,9687,8430,7528,6977,6611,6260,6084,5540,5280,4924,4584,4373,4197,4076,3929,3828,3695,3362,1898,1109,609,0;
13730,11557,9579,7868,7076,6656,6388,6097,5696,5338,5083,4870,4700,4590,4478,4396,4033,3811,1948,1194,700,229,0;
16027,13171,10583,7982,7118,6692,6371,6185,5781,5417,5197,5083,4992,4961,4792,4196,3311,2751,1260,597,359,174,0;
18947,15537,12233,9416,8215,7670,7342,6660,6095,5463,5141,4871,4766,4524,4389,2926,1903,897,512,288,163,97,0;
21106,17297,13588,10513,9584,8982,8305,7261,6199,5406,4996,4595,4283,3824,3026,1357,1172,682,418,196,97,60,0;
23353,19098,14933,11161,10279,8996,8116,7196,5976,5302,4856,4552,3943,3328,1613,1237,958,556,313,157,53,29,0;
25197,20509,15816,11602,10578,8792,7549,7112,5860,5169,4798,4483,3798,2570,1185,1020,731,594,331,172,59,27,0;
26816,21723,16526,11317,10169,8672,7475,7057,5794,5042,4687,4310,3476,2403,1342,979,839,697,442,254,83,36,0;
28328,22765,16902,10802,9806,8752,7542,7103,5878,4951,4485,3868,3301,2367,1642,1318,1147,996,606,318,104,40,0;
29717,23920,17644,10857,9984,8899,7663,7149,5913,4875,4223,3760,3206,2375,1758,1445,1258,1062,653,340,119,47,0;
30638,24767,18164,11811,10290,9037,7624,7195,5997,4789,4069,3605,3089,2389,1803,1545,1346,1131,712,380,134,56,0;
32102,25866,18832,12769,10862,9069,7652,7041,6021,4783,3970,3532,3006,2379,1897,1647,1440,1212,781,412,153,67,0;
33085,26751,19986,13576,11244,9316,7681,6987,6065,4800,3812,3481,2959,2391,1992,1742,1516,1287,848,452,177,80,0;
34156,27592,20946,14138,11703,9812,7927,6933,6099,4851,3728,3431,2947,2452,2094,1842,1602,1371,928,499,205,95,0;
35131,28383,21563,14625,12253,10016,8186,6988,6134,4932,3753,3344,2933,2513,2190,1935,1692,1458,1006,551,233,110,0;
35897,29010,22130,15499,12704,10558,8396,7041,6198,5027,3844,3322,2983,2581,2286,2013,1767,1530,1073,599,247,118,0;
36663,29609,22628,16442,13306,10940,8676,7070,6292,5167,3886,3403,3098,2696,2363,2077,1827,1595,1134,633,259,123,0];

lut(:,:, 6)=[6741,6001,5272,4593,4213,3873,3447,2943,2431,1979,1551,1181,929,741,615,539,482,443,396,350,247,178,0;
7222,6535,5910,5303,4961,4653,4297,3850,3325,2890,2482,2126,1884,1693,1549,1449,1361,1333,1219,1105,704,429,0;
8514,7599,6831,6315,6057,5809,5525,5121,4495,3921,3575,3415,3262,3171,3010,2948,2926,2771,2483,2059,1264,672,0;
9536,8324,7523,7171,7064,6874,6780,6474,6115,5666,5165,4849,4508,4218,3971,3752,3545,3485,3140,2620,1630,893,0;
10708,9149,8018,7426,7188,7073,6950,6649,6453,5959,5439,5061,4767,4432,4259,4150,3967,3742,3589,2645,1604,956,0;
12850,10680,8910,7794,7444,7249,7010,6753,6553,6159,5644,5287,4988,4677,4591,4477,4271,3926,3069,1951,930,382,0;
14637,12105,9835,7934,7668,7280,7085,6777,6547,6178,5762,5420,5207,4928,4690,4459,3879,3581,2405,1146,587,270,0;
17032,14038,11355,9127,8517,8118,7806,7186,6517,6030,5546,5170,4998,4699,4281,3622,3030,2756,755,656,256,139,0;
18967,15630,12632,10069,9300,8626,8094,7373,6337,5718,5192,4738,4342,3782,3448,2612,1739,938,499,279,115,82,0;
21002,17244,13569,10901,9793,8745,7997,7221,6085,5432,4993,4483,3959,3547,2900,1819,978,657,342,169,63,39,0;
22678,18551,14553,11208,10022,8672,7642,6860,5771,5187,4839,4355,3698,3152,2289,1188,774,578,348,179,63,32,0;
24225,19619,15027,10936,9909,8471,7428,6681,5567,5023,4626,4230,3567,2745,1684,1107,859,717,458,268,92,39,0;
25515,20591,15544,10471,9773,8428,7236,6508,5489,4877,4475,3897,3404,2484,1609,1338,1175,1004,625,334,110,41,0;
26660,21487,15956,10512,9920,8426,7206,6588,5452,4690,4299,3747,3179,2366,1680,1410,1235,1079,668,355,119,47,0;
27501,22290,16371,11621,10005,8768,7328,6596,5395,4583,4141,3624,3095,2314,1740,1498,1329,1142,717,382,131,54,0;
28809,23183,17231,12402,10644,8980,7486,6632,5297,4509,3993,3593,3009,2318,1828,1606,1429,1215,781,400,147,63,0;
29772,24039,18048,13154,11082,9224,7628,6695,5194,4444,3860,3543,2963,2333,1936,1719,1506,1282,839,434,168,75,0;
30660,24751,18858,13660,11303,9721,7856,6714,5329,4555,3791,3514,2974,2439,2068,1835,1598,1364,917,479,194,89,0;
31524,25478,19488,14216,11986,10000,8174,6762,5540,4605,3787,3398,2974,2535,2197,1944,1696,1457,999,531,223,104,0;
32450,26191,20150,14817,12357,10509,8486,6885,5646,4685,3850,3328,3008,2644,2326,2034,1775,1531,1067,574,239,112,0;
33419,26895,20708,15335,12944,10989,8752,6939,5798,4902,3882,3428,3160,2801,2418,2105,1838,1597,1129,605,253,119,0];

lut(:,:, 7)=[6044,5513,4986,4500,4239,3976,3666,3277,2677,2242,1808,1417,1154,944,795,694,619,561,456,366,257,191,0;
6547,6028,5573,5138,4921,4675,4407,4046,3467,3055,2662,2309,2065,1869,1715,1595,1493,1387,1330,1160,608,385,0;
7615,6922,6388,6040,5888,5703,5517,5192,4529,3997,3709,3524,3374,3240,3148,3053,3000,2873,2575,2202,1460,753,0;
8492,7453,6937,6709,6623,6510,6401,6207,5915,5395,4980,4709,4502,4302,3938,3662,3502,3255,2890,2511,1670,989,0;
9226,7886,7222,6839,6746,6655,6577,6460,6113,5594,5196,4866,4637,4339,4140,3882,3686,3517,3085,2490,1880,1104,0;
10677,9042,7794,7085,6908,6789,6666,6491,6126,5749,5213,4906,4675,4350,4160,3851,3574,3330,2760,2380,1519,814,0;
12213,10204,8466,7447,7095,6989,6834,6568,6028,5726,5182,4796,4545,4194,3883,3496,3281,2974,2476,1683,690,379,0;
14030,11668,9617,8115,7597,7296,7024,6470,5710,5375,4875,4438,4167,3795,3357,2941,2531,2290,914,592,393,200,0;
15633,12936,10401,8530,7889,7408,6946,6107,5170,4836,4340,3913,3599,3257,2909,2412,1979,1182,638,354,188,130,0;
17335,14268,11308,8887,7972,7432,6712,5661,4880,4445,4017,3662,3295,2876,2689,1915,955,651,447,195,99,51,0;
18794,15433,12150,9231,8180,7463,6490,5427,4718,4265,3857,3476,3104,2578,2283,1429,708,533,405,179,73,41,0;
19936,16374,12894,9768,8306,7477,6368,5026,4484,3984,3644,3312,2932,2394,1781,1164,910,706,513,290,103,42,0;
20949,17217,13569,9991,8683,7658,6295,4783,4200,3584,3367,3140,2745,2274,1402,1188,1060,922,593,320,111,44,0;
21962,18016,14114,10137,9063,7837,6323,4905,4130,3522,3305,3023,2672,2065,1424,1245,1128,1046,649,346,117,46,0;
22867,18766,14525,10880,9540,8183,6486,5030,4103,3487,3287,3017,2684,2024,1455,1329,1224,1112,695,362,124,51,0;
23661,19456,15309,11569,10048,8548,6741,5245,4051,3480,3299,3060,2672,2047,1628,1480,1351,1176,743,379,135,57,0;
24391,20103,15958,12239,10650,8921,7328,5430,4008,3507,3314,3079,2696,2057,1747,1598,1449,1240,793,405,152,67,0;
25098,20718,16511,12734,10892,9511,7643,5637,4183,3523,3357,3128,2771,2258,1947,1783,1549,1314,855,437,172,78,0;
25860,21312,16907,13189,11608,9908,7949,5781,4373,3553,3386,3182,2857,2430,2136,1893,1639,1396,926,482,197,91,0;
26597,21982,17360,13563,11914,10298,8281,6006,4572,3786,3444,3201,2944,2603,2250,1988,1716,1466,990,512,211,98,0;
27254,22428,17865,13912,12316,10851,8676,6217,4805,4010,3629,3362,3178,2817,2409,2068,1783,1533,1052,543,225,105,0];

lut(:,:, 8)=[5445,5059,4676,4323,4139,3937,3677,3322,2696,2256,1848,1479,1243,1036,891,778,692,621,525,389,267,209,0;
5919,5536,5191,4863,4698,4520,4306,3998,3399,2986,2624,2264,2042,1859,1712,1588,1477,1366,1151,1010,473,325,0;
6912,6301,5871,5584,5462,5261,5095,4849,4271,3776,3499,3290,3142,3034,2906,2850,2651,2486,2123,1673,1205,768,0;
7445,6709,6259,6020,5914,5761,5662,5495,5182,4752,4464,4070,3764,3611,3417,3250,3028,2738,2286,1994,1408,869,0;
7842,6895,6435,6188,5996,5931,5818,5672,5408,4922,4521,4196,3989,3812,3602,3459,3221,2905,2482,1985,1547,869,0;
9129,7841,6867,6263,6154,5998,5895,5776,5430,4987,4538,4131,3918,3709,3464,3327,3118,2770,2312,1904,1400,742,0;
10186,8774,7390,6532,6313,6276,6162,5864,5366,4920,4399,3935,3723,3447,3112,2884,2713,2432,2085,767,506,341,0;
11920,10072,8460,7262,6915,6647,6308,5729,5059,4561,4039,3612,3279,2991,2698,2490,2264,1591,599,372,318,191,0;
13294,11209,9172,7557,7279,6769,6187,5327,4570,4020,3552,3174,2864,2566,2353,1919,1406,793,483,267,197,134,0;
14680,12245,9774,7920,7382,6765,5895,4977,4178,3639,3207,2867,2552,2211,1941,1487,813,521,342,177,103,58,0;
15871,13214,10463,8259,7522,6778,5785,4761,3971,3366,3014,2640,2333,2111,1685,951,493,429,307,157,77,43,0;
16889,14072,11223,8783,7744,6972,5738,4518,3739,3127,2816,2482,2188,1798,1357,851,631,531,388,224,96,44,0;
17783,14824,11868,9277,8077,7118,5593,4226,3539,2855,2616,2362,2104,1710,1251,957,789,681,444,255,99,44,0;
18619,15498,12439,9619,8281,7208,5381,4156,3422,2650,2472,2268,2057,1647,1239,1006,867,779,487,266,102,45,0;
19434,16132,12870,10084,8686,7415,5486,4350,3409,2611,2486,2251,2040,1619,1279,1052,950,854,526,277,106,47,0;
20138,16733,13579,10563,9272,7844,6153,4649,3405,2688,2460,2325,2076,1662,1397,1217,1065,933,576,298,115,52,0;
20703,17309,14047,11354,9947,8657,6697,4756,3417,2725,2487,2353,2087,1697,1476,1339,1184,1018,637,327,131,60,0;
21284,17855,14610,11951,10355,9156,7135,4905,3437,2733,2525,2442,2241,1938,1688,1515,1303,1103,702,360,149,69,0;
21889,18357,15013,12260,10817,9456,7309,4949,3504,2872,2648,2499,2348,2094,1852,1615,1393,1182,771,401,170,80,0;
22505,18841,15385,12539,11244,9779,7455,5004,3629,3017,2792,2596,2488,2263,2039,1776,1504,1264,838,433,182,86,0;
23064,19305,15794,12917,11519,10059,7792,5163,3777,3222,3120,3063,2927,2605,2282,1893,1592,1345,904,463,193,91,0];
    
lut(:,:, 9)=[4624,4375,4128,3896,3774,3627,3426,3122,2501,2018,1664,1365,1208,1041,910,809,734,677,582,404,244,205,0;
5040,4787,4542,4302,4182,4042,3857,3586,2977,2514,2217,1984,1824,1678,1583,1501,1402,1250,1018,758,386,281,0;
5711,5424,5083,4812,4696,4507,4371,4158,3699,3259,2970,2830,2654,2505,2354,2059,1840,1620,1293,999,668,467,0;
6240,5751,5329,5036,4934,4777,4690,4523,4197,3777,3361,3136,2994,2803,2635,2398,2250,1922,1707,1267,915,505,0;
6422,5774,5441,5059,4945,4837,4744,4583,4328,3920,3461,3206,3005,2804,3640,2386,2147,1830,1528,1203,806,431,0;
7259,6426,5740,5233,5035,4842,4761,4501,4263,3879,3404,3093,2879,2640,2443,2071,1760,1455,1080,713,347,238,0;
8156,7090,6125,5478,5179,5985,4762,4439,4149,3793,3295,2886,2595,2280,1986,1783,1465,1183,356,156,108,105,0;
9449,8185,7053,6227,5689,5217,4781,4311,3892,3446,2977,2526,2095,1865,1547,1203,378,295,176,79,59,51,0;
10490,8949,7655,6479,5965,5398,4762,4131,3467,2960,2452,2020,1708,1391,1054,393,247,183,125,65,50,46,0;
11536,9833,8292,6889,6216,6619,4784,4013,3282,2691,2188,1776,1469,1177,738,342,288,182,140,80,54,39,0;
12449,10561,8790,7196,6491,5789,4822,3893,3116,2432,1939,1580,1354,998,675,396,337,232,176,98,50,32,0;
13181,11191,9261,7712,6887,6007,4842,3862,2998,2277,1809,1526,1314,1076,775,528,406,365,254,131,75,38,0;
13882,11788,9761,8080,7079,6163,4875,3813,2936,2079,1704,1521,1251,1153,881,694,525,445,299,153,76,39,0;
14555,12363,10227,8450,7344,6374,4885,3798,2877,2027,1709,1562,1331,1279,1048,763,611,513,342,174,81,40,0;
15087,12776,10637,8882,7723,6804,4955,3928,2889,2082,1715,1608,1460,1314,1073,832,683,575,395,200,87,42,0;
15617,13257,11054,9422,8279,7203,5517,4119,2942,2106,1824,1763,1638,1478,1261,964,822,681,453,231,96,45,0;
16191,13799,11553,9797,8723,7611,5821,4226,3014,2189,1975,1867,1723,1539,1323,1109,963,816,526,267,111,52,0;
16692,14162,11890,10082,9097,7925,5990,4326,3023,2297,2073,2020,1843,1697,1500,1314,1098,923,595,305,129,60,0;
17149,14598,12284,10292,9215,8047,6128,4397,3082,2339,2209,2103,2006,1850,1618,1394,1179,1004,658,343,147,70,0;
17628,15027,12656,10529,9450,8245,6145,4440,3190,2370,2320,2190,2170,2000,1740,1491,1270,1084,719,373,159,75,0;
18123,15428,12988,10706,9587,8466,6263,4626,3587,3056,2981,2800,2700,2347,2006,1665,1403,1174,781,402,170,80,0];

    
lut(:,:, 10)=[4070,3883,3698,3525,3433,3322,3163,2914,2391,1936,1606,1334,1173,1026,909,814,745,694,588,397,225,141,0;
4436,4247,4061,3869,3770,3658,3506,3285,2784,2367,2081,1857,1694,1565,1498,1357,1200,1087,867,667,381,242,0;
5023,4806,4538,4290,4171,3983,3844,3645,3267,2878,2711,2500,2257,2069,1905,1622,1460,1290,977,772,446,301,0;
5366,5081,4741,4434,4269,4138,3950,3838,3516,3199,2912,2701,2467,2285,2108,1940,1830,1630,1250,840,500,316,0;
5647,5188,4869,4445,4298,4131,3988,3819,3555,3240,2951,2724,2500,2310,2160,1875,1678,1474,1011,423,296,205,0;
6233,5596,5072,4528,4310,4067,3904,3659,3418,3067,2773,2526,2277,2039,1798,1396,1180,989,312,251,211,131,0;
7031,6267,5500,4700,4430,4100,3855,3447,3243,2878,2516,2291,1905,1640,1420,1073,920,310,214,118,78,76,0;
8214,7105,6221,5242,4662,4271,3813,3405,2952,2526,2112,1723,1389,1096,918,377,315,205,105,41,39,36,0;
8959,7711,6598,5472,4982,4417,3841,3375,2830,2300,1816,1410,1109,911,385,119,110,77,71,50,37,31,0;
9851,8471,7225,5977,5407,4720,3900,3367,2739,2119,1603,1215,971,753,293,172,139,119,99,59,40,27,0;
10436,9128,7655,6409,5706,4923,3949,3364,2690,1985,1492,1101,889,689,354,300,245,195,154,81,45,26,0;
11000,9572,7996,6675,5958,5076,4002,3360,2680,1910,1409,1138,922,772,414,404,329,294,221,109,66,35,0;
11291,9879,8449,7028,6239,5226,4061,3326,2680,1904,1456,1244,1077,923,693,586,454,361,251,131,70,36,0;
11695,10442,8797,7329,6398,5397,5163,3353,2698,1927,1529,1383,1174,1097,862,685,539,418,294,154,75,38,0;
12117,10856,9117,7579,6726,5903,4418,3478,2772,2010,1637,1431,1254,1154,921,726,573,465,341,183,82,40,0;
12466,11071,9431,7831,7005,6089,4517,3728,2908,2140,1867,1621,1469,1345,1105,909,704,564,401,214,91,43,0;
13176,11559,9782,8050,7166,6225,4603,3885,3060,2229,1986,1781,1627,1472,1254,1065,868,721,483,252,105,49,0;
14034,12051,10061,8249,7390,6426,4668,3941,3128,2355,2150,1949,1811,1623,1447,1220,1023,852,558,290,122,57,0;
14607,12508,10487,8532,7609,6605,4731,4011,3192,2432,2217,2093,1955,1730,1554,1342,1126,945,622,326,140,66,0;
14975,12908,10907,8703,7863,6710,4821,4080,3250,2490,2284,2170,2077,1921,1676,1441,1227,1034,683,355,152,72,0;
15432,13298,11407,8898,8033,6904,4932,4219,3398,2827,2737,2527,2420,2168,1912,1606,1370,1142,749,384,162,76,0];

lut(:,:, 11)=[3505,3372,3240,3113,3046,2965,2846,2654,2242,1848,1544,1296,1129,992,884,799,736,691,585,384,202,113,0;
3808,3676,3552,3413,3338,3250,3129,2951,2557,2195,1919,1710,1527,1363,1230,1114,1035,930,790,565,310,185,0;
4244,4060,3897,3721,3617,3500,3371,3206,2909,2586,2280,1961,1791,1575,1469,1262,1193,1023,811,595,342,204,0;
4479,4268,4074,3858,3727,3586,3448,3301,2996,2701,2358,2100,1970,1756,1651,1481,1308,1143,842,615,347,217,0;
4680,4404,4184,3876,3713,3545,3401,3249,3001,2641,2373,2089,1825,1559,1422,1273,1087,1017,319,298,192,119,0;
5155,4929,4487,3917,3666,3417,3241,3056,2841,2505,2177,1849,1591,1332,1131,885,769,502,265,135,79,77,0;
6001,5588,4980,4089,3670,3378,3049,2693,2399,2051,1731,1466,1244,1017,854,745,649,295,224,102,67,49,0;
6787,6145,5185,4364,3798,3406,3003,2583,2218,1807,1498,1200,971,765,555,196,180,138,119,53,43,34,0;
7188,6465,5394,4496,3995,3628,3201,2686,2221,1751,1444,1121,879,603,419,176,125,108,93,58,41,26,0;
7630,6781,5886,4902,4465,4006,3295,2832,2224,1773,1391,1024,831,564,312,213,139,119,102,62,42,27,0;
7824,7031,6139,5394,4701,4236,3320,2894,2333,1831,1396,1082,865,604,318,275,237,201,146,80,47,31,0;
8111,7338,6268,5532,4884,4356,3417,2963,2433,1897,1444,1140,927,710,491,420,340,281,200,108,61,32,0;
8329,7457,6488,5706,5185,4498,3518,2992,2511,2029,1603,1307,1103,854,722,590,467,365,245,125,65,33,0;
8718,7543,6537,5730,5344,4748,3789,3092,2558,2105,1709,1449,1207,1005,835,676,558,421,287,148,70,34,0;
8978,7649,6594,5732,5451,4912,3963,3214,2692,2161,1745,1510,1280,1062,916,746,599,465,329,174,76,36,0;
9249,7760,6609,5753,5505,4944,4043,3419,3026,2433,1989,1746,1475,1298,1107,940,746,572,390,206,87,40,0;
9831,8166,6738,5864,5509,4956,4110,3463,3170,2575,2209,1986,1686,1420,1253,1082,893,709,468,242,101,47,0;
10687,8715,6808,5894,5553,4972,4129,3544,3208,2617,2326,2201,1908,1609,1448,1241,1034,834,539,280,118,55,0;
11414,9448,7169,6008,5694,4993,4140,3605,3202,2682,2339,2261,2018,1745,1556,1343,1129,924,603,317,136,64,0;
12199,10064,7714,6137,5700,5016,4159,3729,3240,2689,2350,2270,2120,1836,1638,1433,1216,1013,666,347,148,70,0;
12874,10581,8108,6231,5878,5214,4370,3809,3276,2806,2508,2342,2217,2033,1803,1565,1338,1116,733,376,159,75,0];

lut(:,:, 12)=[2869,2780,2691,2603,2556,2500,2417,2276,1978,1667,1411,1199,1036,903,820,739,668,640,535,317,165,92,0;
3101,3014,2934,2837,2785,2723,2645,2508,2242,1962,1719,1460,1271,1132,982,882,821,750,569,391,219,145,0;
3434,3308,3154,3001,2897,2804,2716,2551,2331,2102,1818,1590,1419,1254,1153,1024,951,846,617,418,244,166,0;
3612,3465,3314,3127,2988,2833,2733,2585,2414,2206,1909,1718,1562,1451,1257,1129,1019,859,618,463,259,164,0;
3761,3553,3386,3152,2997,2819,2693,2534,2417,2180,1909,1595,1406,1261,1052,926,793,598,392,286,127,90,0;
4113,3800,3588,3251,3055,2798,2610,2387,2251,1985,1703,1280,1113,978,780,694,578,432,229,150,89,69,0;
4785,4471,4003,3460,3102,2756,2504,2201,1918,1634,1353,1039,952,814,665,530,455,325,192,90,59,45,0;
5406,4726,4165,3659,3280,2939,2419,2111,1888,1505,1226,1005,879,671,522,364,231,168,134,67,46,33,0;
5808,5019,4352,3777,3449,3071,2740,2250,1921,1623,1328,1118,918,715,502,244,203,172,127,84,51,28,0;
6312,5514,4978,4407,3973,3504,2954,2494,2086,1747,1450,1213,1004,795,531,347,265,211,153,93,52,28,0;
6858,5972,5429,4894,4332,3748,3146,2611,2209,1857,1533,1269,1101,817,655,481,380,300,216,113,57,29,0;
7286,6326,5695,5018,4511,3907,3255,2653,2311,1956,1614,1345,1170,831,717,541,435,353,248,123,59,29,0;
7568,6686,5875,5296,4700,4136,3392,2756,2428,2157,1828,1560,1325,1030,886,710,607,453,297,138,62,30,0;
8015,6902,6071,5483,4889,4352,3511,2876,2569,2225,1960,1684,1465,1164,988,808,674,525,335,155,66,31,0;
8249,7179,6183,5529,5058,4562,3707,3017,2698,2293,2024,1777,1574,1220,1041,890,731,567,377,182,72,33,0;
8569,7489,6212,5601,5064,4609,3752,3226,2913,2638,2244,2036,1731,1424,1265,1067,870,666,427,207,84,39,0;
9059,7714,6377,5610,5103,4624,3812,3382,3073,2798,2412,2191,1900,1600,1392,1180,981,764,491,246,99,46,0;
9480,8189,6573,5714,5255,4650,3828,3484,3126,2883,2531,2275,2016,1716,1524,1290,1086,854,549,278,116,54,0;
9832,8567,6874,5878,5336,4677,3850,3511,3183,2888,2549,2298,2068,1801,1573,1376,1167,933,607,314,135,63,0;
10170,8880,7084,5947,5402,4698,3872,3520,3190,2890,2571,2325,2104,1848,1618,1440,1229,1012,662,344,147,69,0;
10566,9241,7422,6073,5475,4741,3960,3663,3204,2928,2610,2356,2160,1938,1739,1538,1321,1098,722,373,158,74,0];

lut(:,:, 13)=[2198,2136,2076,1999,1970,1955,1900,1809,1617,1402,1218,1063,936,822,732,660,599,569,434,260,138,84,0;
2377,2295,2209,2043,2002,1960,1886,1782,1647,1408,1260,1138,1042,922,824,744,684,620,474,310,177,117,0;
2416,2316,2220,2084,2003,1944,1847,1733,1653,1405,1278,1157,1065,958,886,784,744,648,521,331,185,132,0;
2566,2353,2230,2083,1952,1895,1783,1646,1558,1407,1285,1149,1076,1009,933,821,775,661,527,322,175,119,0;
2609,2392,2232,1998,1899,1775,1655,1447,1350,1196,1113,1025,938,826,732,648,579,454,297,214,142,66,0;
2878,2510,2247,1993,1892,1754,1607,1429,1277,1153,1052,903,794,680,578,516,450,334,169,144,90,49,0;
3081,2635,2312,1971,1877,1728,1574,1448,1279,1145,1018,870,749,670,550,426,394,260,137,80,56,36,0;
3760,3260,2858,2479,2206,2032,1847,1599,1404,1231,1102,903,794,681,524,379,274,215,151,90,53,29,0;
4277,3648,3255,2811,2566,2287,2119,1844,1640,1469,1351,1222,1093,956,757,420,307,267,162,98,51,25,0;
4845,4453,4036,3480,3095,2681,2407,2016,1838,1623,1470,1319,1149,1025,832,523,406,338,226,119,52,25,0;
5472,4760,4329,3736,3279,2831,2533,2167,1945,1728,1516,1352,1216,1094,876,629,493,426,287,137,55,25,0;
5983,5028,4457,3802,3381,2894,2615,2280,2042,1825,1550,1453,1243,1123,899,743,571,500,384,166,59,26,0;
6459,5438,4798,4000,3533,3059,2685,2383,2241,2004,1738,1639,1446,1216,1029,876,710,621,453,183,61,27,0;
6562,5560,4925,4189,3748,3266,2801,2496,2325,2136,1926,1736,1565,1316,1102,957,751,676,482,195,64,28,0;
6719,5688,5048,4297,3973,3492,2895,2606,2414,2245,2083,1796,1648,1388,1186,1009,795,720,489,213,72,31,0;
6820,5875,5205,4521,4157,3696,3053,2937,2717,2510,2265,2077,1861,1603,1360,1192,966,770,539,237,84,37,0;
7067,6118,5412,4662,4293,3757,3123,3002,2856,2696,2421,2216,1969,1727,1465,1300,1063,861,585,266,99,44,0;
7342,6385,5570,4764,4337,3813,3140,3018,2907,2781,2531,2305,2073,1825,1560,1376,1158,912,611,292,116,53,0;
7625,6606,5716,4835,4412,3893,3166,3061,2921,2794,2536,2308,2080,1840,1594,1415,1208,968,640,320,133,62,0;
7930,6835,5901,4941,4486,3929,3216,3070,2954,2636,2471,2326,2095,1875,1609,1443,1248,1022,670,342,143,67,0;
8158,7075,6071,5107,4545,4009,3308,3110,2958,2771,2602,2356,2130,1923,1698,1501,1304,1084,711,364,152,71,0];

lut(:,:, 14)=[1654,1497,1378,1240,1185,1179,1141,1092,992,947,900,872,787,719,646,568,493,438,347,213,94,55,0;
1692,1489,1356,1213,1172,1163,1123,1077,1004,950,898,848,780,715,659,575,528,451,345,230,118,73,0;
1706,1438,1300,1188,1163,1141,1114,1072,1028,974,914,840,784,709,656,595,540,470,343,234,137,75,0;
1739,1427,1208,1130,1110,1080,1070,1020,990,945,900,830,780,700,640,600,542,468,288,224,131,72,0;
1744,1338,1183,1030,975,940,903,879,835,797,761,729,680,624,545,488,438,388,204,153,90,53,0;
1796,1502,1237,1106,1029,968,914,810,766,730,695,637,585,550,502,444,342,292,170,109,75,41,0;
1882,1636,1409,1200,1133,1086,1026,965,876,817,761,650,607,561,508,419,293,246,126,74,49,27,0;
2459,2183,1889,1665,1549,1428,1318,1166,1045,982,905,835,763,700,620,439,286,224,130,75,42,22,0;
3017,2693,2372,2088,1927,1729,1584,1395,1284,1221,1133,1046,977,872,812,611,423,268,152,89,44,21,0;
3580,3154,2849,2542,2239,1971,1775,1612,1465,1360,1230,1154,1105,971,853,688,473,377,228,117,46,21,0;
3946,3437,3038,2636,2359,2051,1906,1702,1562,1423,1270,1202,1157,1033,915,703,569,450,290,134,50,21,0;
4162,3558,3067,2640,2400,2139,2011,1828,1658,1510,1380,1264,1190,1069,961,791,617,536,367,159,54,22,0;
4261,3767,3268,2802,2543,2280,2138,1992,1875,1702,1585,1465,1341,1244,1086,920,741,649,439,178,57,23,0;
4358,3923,3486,2992,2700,2470,2247,2101,1915,1788,1674,1539,1441,1344,1129,992,819,690,457,189,61,24,0;
4517,4139,3648,3114,2874,2595,2381,2211,1995,1818,1716,1631,1517,1390,1167,1081,829,739,476,208,68,28,0;
4718,4385,3876,3323,3012,2758,2579,2409,2214,2051,1957,1834,1687,1561,1328,1215,987,799,521,230,79,33,0;
4922,4545,3983,3420,3175,2922,2691,2519,2353,2183,2082,1969,1796,1639,1413,1311,1080,884,576,259,94,40,0;
5124,4667,4071,3515,3249,3017,2812,2638,2469,2247,2159,2024,1893,1721,1514,1362,1155,939,607,280,109,47,0;
5323,4730,4120,3536,3303,3069,2878,2731,2531,2333,2205,2098,1934,1757,1553,1404,1201,986,639,302,123,52,0;
5538,4808,4165,3580,3336,3093,2892,2771,2599,2396,2282,2128,1964,1774,1588,1436,1244,1028,679,322,128,56,0;
5768,4925,4220,3625,3375,3155,2951,2843,2697,2484,2345,2177,2017,1850,1667,1484,1289,1074,699,330,130,57,0];

lut(:,:, 15)=[1584,1462,1324,1222,1184,1147,1084,1008,939,904,821,733,644,570,501,440,415,366,309,194,84,45,0;
1587,1456,1301,1194,1164,1119,1062,999,938,900,823,736,685,650,578,501,457,411,303,197,99,53,0;
1589,1439,1270,1177,1124,1111,1060,992,948,894,826,739,697,668,599,527,469,417,300,198,102,55,0;
1601,1314,1133,1114,1102,1069,1037,959,925,857,801,730,700,669,600,510,473,399,278,169,97,56,0;
1617,1307,990,981,959,925,878,828,789,727,661,608,587,556,524,459,400,327,180,142,70,50,0;
1643,1411,1153,1045,1007,949,900,799,712,652,616,553,530,515,479,418,324,236,115,97,57,33,0;
1787,1566,1328,1211,1130,1045,992,908,807,765,708,628,583,533,470,375,280,209,111,69,42,21,0;
2261,1991,1764,1570,1422,1344,1228,1115,998,943,894,800,758,675,545,404,251,209,117,71,36,17,0;
2689,2248,1983,1711,1594,1490,1395,1327,1225,1193,1101,971,874,812,741,526,343,230,150,88,35,15,0;
2997,2554,2223,1903,1733,1609,1519,1426,1314,1260,1183,1109,988,900,816,623,445,349,214,102,36,15,0;
3238,2847,2465,2068,1880,1706,1644,1547,1457,1302,1193,1170,1053,958,884,681,535,425,286,119,39,15,0;
3393,2953,2590,2193,2012,1859,1772,1672,1543,1397,1284,1215,1130,993,933,773,601,516,343,138,42,16,0;
3482,3160,2776,2356,2159,2004,1924,1794,1654,1541,1428,1347,1256,1155,1027,891,726,627,389,155,45,17,0;
3532,3270,2896,2517,2289,2142,2028,1906,1752,1624,1544,1500,1348,1274,1100,973,809,674,421,167,49,18,0;
3660,3436,3101,2646,2456,2256,2172,2016,1834,1742,1660,1596,1457,1350,1160,1063,818,711,451,181,54,21,0;
3803,3603,3229,2831,2608,2447,2288,2165,1973,1880,1808,1726,1603,1482,1300,1184,939,793,492,199,61,24,0;
3955,3698,3320,2917,2733,2544,2379,2256,2073,1965,1884,1823,1695,1572,1379,1277,1038,867,544,221,70,28,0;
4116,3784,3378,2975,2801,2599,2485,2355,2203,2056,1990,1903,1780,1652,1478,1334,1100,924,579,239,78,32,0;
4275,3839,3393,2985,2850,2658,2529,2447,2294,2117,2050,1971,1835,1693,1523,1373,1163,969,601,254,85,35,0;
4471,3887,3394,3000,2880,2700,2589,2496,2361,2216,2129,2033,1872,1737,1566,1403,1214,1003,640,272,91,39,0;
4689,3970,3405,3030,2900,2740,2598,2498,2410,2287,2170,2067,1902,1790,1622,1439,1260,1026,667,290,96,42,0];


stopp=0;
stopg=0;
stopx=0;

for ppp=2:15
               if (stopp==0&&p<=pdata(ppp))
                   pp=ppp;
                   stopp=1;
               end
end

for ggg=2:21
               if (stopg==0&&g<=gdata(ggg))
                   gg=ggg;
                   stopg=1;
               end
end


for xxx=2:23
               if (stopx==0&&x<=xdata(xxx))
                   xx=xxx;
                   stopx=1;
               end

end

g0p0=lut(gg-1,xx-1,pp-1)+(x-xdata(xx-1))*(lut(gg-1,xx,pp-1)-lut(gg-1,xx-1,pp-1))/(xdata(xx)-xdata(xx-1));
g0p1=lut(gg-1,xx-1,pp)+(x-xdata(xx-1))*(lut(gg-1,xx,pp)-lut(gg-1,xx-1,pp))/(xdata(xx)-xdata(xx-1));
g1p0=lut(gg,xx-1,pp-1)+(x-xdata(xx-1))*(lut(gg,xx,pp-1)-lut(gg,xx-1,pp-1))/(xdata(xx)-xdata(xx-1));
g1p1=lut(gg,xx-1,pp)+(x-xdata(xx-1))*(lut(gg,xx,pp)-lut(gg,xx-1,pp))/(xdata(xx)-xdata(xx-1));
% then interpolating g*/
p0=g0p0+(g-gdata(gg-1))*(g1p0-g0p0)/(gdata(gg)-gdata(gg-1));
p1=g0p1+(g-gdata(gg-1))*(g1p1-g0p1)/(gdata(gg)-gdata(gg-1));
% finally we interpolate p*/
final=p0+(p-pdata(pp-1))*(p1-p0)/(pdata(pp)-pdata(pp-1));


end
