//============================================================================
// Name : CppTest.cpp
// Author : nsos
// Version :
// Copyright : Your copyright notice
// Description : Hackerank in C++, Ansi-style
//============================================================================
#include <cmath>
#include <cstdio>
#include <vector>
#include <map>
#include <iostream>
#include <algorithm>
using namespace std;
/*
https://www.hackerrank.com/contests/world-codesprint-5/challenges/mining
M=4 N=? (N<M)
5 6
15 5
20 8
25 5
35 10
# 1 2 3 4 5
1 0 60 90 120 180
2 50 0 25 50 100
3 120 40 0 40 120
4 100 50 25 0 50
5 300 200 150 100 0
550 350 290 310 450
F(1,1,1) = 0
F(1,2,1) = 50
F(1,3,1) = 25 F(1,3,2) = 25
F(1,4,1) = 140 F(1,4,2) = 50 F(1,4,3) = 25
F(1,5,1) = 290 F(1,5,2) = 140 F(1,5,3) = 50 F(1,5,4) = 25
F(x,y,n) = min{F(x,i,j)+F(i+1,y,n-j)} 1<=x<i<y<=M, 0<=j<i-x, 0<=n-j<y-i-1
*/
int solve(vector<int> &pos, vector<int> &weight, int m, int n)
{
int i,j;
vector<vector<int> > score(m+1, vector<int>(m+1, 0));
vector<vector<vector<int> > > dp(m+1, vector<vector<int> >(m+1, vector<int>(n+1, 0)));
for (i=1; i<=m; ++i)
for (j=1; j<=m; ++j)
score[i][j] = abs(pos[j]-pos[i])*weight[i];
return 0;
}
int main() {
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
int m,n,x,y,ret;
cin>>m>>n;
vector<int> pos;
vector<int> weight;
for (int i=0; i<m; ++i)
{
cin>>x>>y;
pos.push_back(x);
weight.push_back(y);
}
ret = solve(pos, weight, m, n);
cout<<ret<<endl;
return 0;
}