#include "aliens.h"
#include<cstdio>
#include <cassert>
#include<algorithm>
#define ll long long
using namespace std;
const int N=100010;
struct node{
int x,y;
}p[N],p1[N];
inline bool cmp(const node &a,const node &b){return a.x<b.x;}
int top,q[N],num[N];ll ans,dp[N];
inline ll sqr(ll x){return x*x;}
inline double calc(int k,int j){
return ((double)dp[k-1]-dp[j-1]-sqr(p[j].y)+2*p[j].y-2*p[k].y+sqr(p[k].y))/(p[k].y-p[j].y);
}
inline int gao(ll c,int n){
int op=1,cl=1;q[op]=0;
for (int i=1;i<=n;++i){
while(op<cl&&calc(q[op]+1,q[op+1]+1)<2*p[i].x) ++op;
int j=q[op];num[i]=num[j]+1;
dp[i]=dp[j]+sqr(p[i].x-p[j+1].y+1)+c;
if (i==n) break;
if (p[i+1].y<=p[i].x) dp[i]-=sqr(p[i].x-p[i+1].y+1);
while(op<cl&&calc(q[cl-1]+1,q[cl]+1)>calc(q[cl]+1,i+1)) --cl;q[++cl]=i;
}return num[n];
}
long long take_photos(int n, int m, int k, std::vector<int> r, std::vector<int> c) {
for (int i=0;i<n;++i) {p[i+1].x=c[i],p[i+1].y=r[i];if (r[i]>c[i]) swap(p[i+1].x,p[i+1].y);}
sort(p+1,p+n+1,cmp);ll l1=0,r1=(ll)m*m;
for (int i=1;i<=n;++i){
while(top&&p[i].y<=p1[top].y) --top;
p1[++top]=p[i];
}n=top;for (int i=1;i<=n;++i) p[i]=p1[i];
if (n<=k) {
for (int i=1;i<=n;++i) {ans+=sqr(p[i].x-p[i].y+1);
if (i<n&&p[i+1].y<=p[i].x) ans-=sqr(p[i].x-p[i+1].y+1);}
return ans;
}
//for (int i=1;i<=n;++i) printf("%d %d\n",p[i].x,p[i].y);
while(l1<=r1){
ll mid=l1+r1>>1;
if (gao(mid,n)<=k) ans=dp[n],r1=mid-1;else l1=mid+1;
}return ans-l1*k;
//printf("%lld\n",ans-l1*k);
}
int main() {
freopen("ex_aliens1.in","r",stdin);
int n, m, k;
assert(3 == scanf("%d %d %d", &n, &m, &k));
std::vector<int> r(n), c(n);
for (int i = 0; i < n; i++) {
assert(2 == scanf("%d %d", &r[i], &c[i]));
}
long long ans = take_photos(n, m, k, r, c);
printf("%lld\n", ans);
return 0;
}